位操作基础篇之位操作全面总结

Title: 位操作基础篇之位操作全面总结
Author: MoreWindows
E-mail: morewindows@126.com
KeyWord: C/C++ 位操作 位操作技巧 判断奇偶 交换两数 变换符号 求绝对值 位操作压缩空间 筛素数 位操作趣味应用 位操作笔试面试

Read More

Italic fonts in iTerm2 tmux and vim

Run following command to fix italic fonts

{ infocmp -1 xterm-256color ; echo -e "\tsitm=\\E[3m,\n\tritm=\\E[23m,"; } > xterm-256color.terminfo
tic xterm-256color.terminfo
rm xterm-256color.terminfo
Read More

Setup Manjaro Xfce Desktop

Enable touchpad tap to click

  1. Install xorg-xinput via Package Manager
  2. Query touchpad device id
    xinput list
    

    Output example:

    ⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
    ⎜   ↳ Sony Vaio Jogdial                       	id=7	[slave  pointer  (2)]
    ⎜   ↳ SynPS/2 Synaptics TouchPad              	id=14	[slave  pointer  (2)]
    ⎜   ↳ Logitech USB Receiver                   	id=12	[slave  pointer  (2)]
    ⎜   ↳ Logitech USB Receiver                   	id=11	[slave  pointer  (2)]
    ⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
     ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
     ↳ AT Translated Set 2 keyboard            	id=13	[slave  keyboard (3)]
     ↳ Video Bus                               	id=8	[slave  keyboard (3)]
     ↳ Sony Vaio Jogdial                       	id=15	[slave  keyboard (3)]
     ↳ Sony Vaio Keys                          	id=6	[slave  keyboard (3)]
     ↳ Power Button                            	id=9	[slave  keyboard (3)]
     ↳ Logitech USB Receiver                   	id=16	[slave  keyboard (3)]
     ↳ UVC Camera (05ca:18b5)                  	id=10	[slave  keyboard (3)]
    
  3. List TouchPad properties
    xinput list-props 14
    

    Output example:

    Device 'SynPS/2 Synaptics TouchPad':
     Device Enabled (142):	1
     Coordinate Transformation Matrix (144):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
     libinput Tapping Enabled (295):	0
     libinput Tapping Enabled Default (296):	0
     libinput Tapping Drag Enabled (297):	1
     libinput Tapping Drag Enabled Default (298):	1
     libinput Tapping Drag Lock Enabled (299):	0
     libinput Tapping Drag Lock Enabled Default (300):	0
     libinput Tapping Button Mapping Enabled (301):	1, 0
     libinput Tapping Button Mapping Default (302):	1, 0
     libinput Accel Speed (281):	0.000000
     libinput Accel Speed Default (282):	0.000000
     libinput Natural Scrolling Enabled (277):	0
     libinput Natural Scrolling Enabled Default (278):	0
     libinput Send Events Modes Available (262):	1, 1
     libinput Send Events Mode Enabled (263):	0, 0
     libinput Send Events Mode Enabled Default (264):	0, 0
     libinput Left Handed Enabled (286):	0
     libinput Left Handed Enabled Default (287):	0
    ......
    
  4. Enable tap to click
    xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1
    
  5. Add command in step 4 to .xsession file to make sure enable tape to click after reboot
Read More

Force Replication Between Domain Controllers

  1. Open Active Directory Sites and Services: On the Start menu, point to Administrative Tools, and then click Active Directory Sites and Services.
  2. In the console tree, expand Sites, and then expand the site to which you want to force replication from the updated server.
  3. Expand the Servers container to display the list of servers that are currently configured for that site.
  4. Expand the server objects and click their NTDS Settings objects to display their connection objects in the details pane. Find a server that has a connection object from the server on which you made the updates.
  5. Click NTDS Settings below the server object. In the details pane, right-click the connection object whose From Server is the domain controller that has the updates that you want to replicate, and then click Replicate Now.
  6. When the Replicate Now message box appears, review the information, and then click OK.
Read More

BI Report Tools

Our database has more then 42 millions records. We need to create reports for different roles.
I prefer opensource BI since we can build the website on our own server and access data directly.

Read More

How to install pip on Ubuntu 16

  1. Upgrade packages to the latest version
    sudo apt-get update && sudo apt-get -y upgrade
    
  2. Install python-pip
    sudo apt-get install python-pip
    
  3. Check version
    pip -V
    
Read More

CIFS Samba mount hangs for several minutes

Symptom

Add a network share folder in /etc/fstab

//windows-server/shared /mnt/shared cifs  iocharset=utf8,credentials=/root/.naspasswd,dir_mode=0750,file_mode=0750  0 0

Most time it works well. But every few days or weeks, the connection or the mount point seems to go dead or hang, such that any process that tries to access the mount point gets stuck in D state (disk, or I/O wait). those processed become impervious to TERM and KILL signals. The frozen state lasts for 5+ minutes.

Read More

Install Ansible on Mac OSX

Brew Install

  • Install Homebrew if there is no brew.
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  • Install Ansible
    brew install ansible
    
Read More