avoid rebuilding all in vs2010 everytime

  1. remove all nonexisted files in vs2010 project tree view by double clicking one by one.
  2. remove readonly attributes of file in explorer project directory recursively.
  3. reset all modify times to recent by

    1
    
    find . | xargs touch {}
  4. reboot system.

open sourced pdf reader

Windows lacks non money smell softwares.

If we encouter warning C4819 when building, change system setting 'Language for non-Unicode programs' to 'US/English' and reboot.

https://www.sumatrapdfreader.org/docs/Contribute-to-SumatraPDF
https://github.com/sumatrapdfreader/sumatrapdf

Tricks,

SumatraPDF.exe -invert-colors

refer to:
https://www.cnblogs.com/Steven-HU/p/14547749.html
https://www.cnblogs.com/chenxi188/p/15585702.html

bad security of vmware guest isolation from host

1. without administrative privilege, only using guest os user password, we can copy any file from guest to host by

#startup win7.vmx first.
vmrun.exe -gu guest_os_user_name -gp guest_os_user_password copyFileFromGuestToHost "E:\vmimg\win7\win7.vmx" c:\windows\system32\notepad.exe e:\notepad.exe

2. example about communication between guest and host using vmware backdoor routines:
https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/services/plugins/dndcp

refer to:
n0nick

start tiny web server with current folder as http root path

httpd.py

1
2
3
4
5
6
7
8
9
10
from http.server import HTTPServer, SimpleHTTPRequestHandler
 
handler = SimpleHTTPRequestHandler
handler.extensions_map.update({
	".js": "application/javascript",
})
 
server_address = ("", 8008)
server = HTTPServer(server_address, handler)
server.serve_forever()

how to run

1
python3 ./httpd.py

unknown filesystem type 'vmhgfs'

because vmhgfs-fuse is not built,

1
apt install libfuse-dev

before compiling open-vm-tools.

following is the autorun scripts, e.g. open-vm-tools are installed in /home/work/vmware/open-vm-tools/open-vm-tools/installed.

  • /etc/xdg/autostart/vmware-user.desktop

    1
    2
    3
    4
    5
    6
    
    [Desktop Entry]
    Type=Application
    Encoding=UTF-8
    Exec=/home/work/vmware/open-vm-tools/open-vm-tools/installed/bin/vmware-user-suid-wrapper
    Name=VMware User Agent
    X-KDE-autostart-phase=1
  • /etc/rc.local

    1
    2
    3
    4
    5
    6
    7
    
    #!/bin/bash
    (
    cd /home/work/vmware/open-vm-tools/open-vm-tools/installed/bin/
    LD_LIBRARY_PATH=`pwd`/../lib:$LD_LIBRARY_PATH ./vmtoolsd &
    ./vmhgfs-fuse /mnt/hgfs/
    ./vmware-user
    )
1
2
chmod +x /etc/rc.local
reboot

git备忘录

1
2
3
4
5
6
7
8
git branch -a
git fetch
git checkout
git remote -v
git remote set-url origin https://github.com/euhat/EuhatExpert.git
git reset --soft HEAD^
git clean -xfd
git submodule update --init --recursive

copy and paste between vmware centos guest and host failed

some centos distribution has no open-vm-tools package, so we need to compile it by hand:

yum install libmspack-devel pam-devel xmlsec1-devel libXext-devel libXinerama-devel libXrender-devel libXrandr-devel libXtst-devel gtk3-devel gtkmm30-devel libtirpc-devel rpcgen libtool-devel

git clone https://github.com/vmware/open-vm-tools.git
cd open-vm-tools/open-vm-tools
autoreconf -i
./configure
make
make install

vmware-user

ps. how to enable auto-fitting with resolution

#install driver
yum install xorg-x11-drv-vmware
#add option to configure open-vm-tools
./configure --enable-resolutionkms
make
make install
#startup two vmtoolsds, one for vmusr, one for vmsvc which serves auto-resizing
vmware-user
vmtoolsd

refer to:
https://docs.vmware.com/en/VMware-Tools/11.3.0/com.vmware.vsphere.vmwaretools.doc/GUID-8B6EA5B7-453B-48AA-92E5-DB7F061341D1.html

mysql备忘录

密码问题

1
2
3
#/etc/my.cnf
[mysqld]
skip-grant-tables=1
1
2
FLUSH privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'admin@123';

重启

1
systemctl restart mysqld

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
Could not create connection to database server. Attempted reconnect 3

https://www.cnblogs.com/ianhuafeng/p/12403626.html
https://zhuanlan.zhihu.com/p/632935077

Install MySql in Windows, download zip file from https://dev.mysql.com/downloads/windows/installer/5.7.html

mysqld --initialize --console
mysqld --install mysql
net stop mysql
mysqld --skip-grant-tables
	mysql -u root -p
		use mysql;
		select * from user;
		update user set authentication_string=password("123456") where user="root";
		flush privileges;
net start mysql

refer to:
https://www.cnblogs.com/huaisn/articles/14149356.html

comparing ubuntu with centos in package management

yum

1
2
3
4
5
6
7
8
9
10
11
12
# find which package the cmd 'a.out' belongs to
yum provides */bin/a.out
# check if 'wget' package is installed
yum list installed | grep wget
# download 'wget' package to /tmp/rpm/
yum install yum-plugin-downloadonly
yum download --downloaddir=/tmp/rpm/ --downloadonly wget
# list all files in 'wget' package
rpm -qlp /tmp/rpm/wget*.rpm
# another method listing files without downloading
yum install yum-utils
repoquery -l wget

apt

1
2
3
4
5
6
# find which package 'Python.h' belongs to
apt install apt-file
apt-file update
apt-file search Python.h
# list all files in 'wget' package
dpkg -L wget

package names

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  ubuntu			  centos
install build-essential		groupinstall "Development tools"
xfce4				@xfce-desktop
ssh				openssh-clients
udev				systemd-udev
libc6-dev			glibc-devel
libglib2.0-dev			glib2-devel
libffi-dev			libffi-devel
libncurses5			ncurses
libncurses5-dev			ncurses-devel
libsqlite3-dev			sqlite-devel
libnet1-dev			libnet-devel
libreadline6			readline
bridge-utils			bridge-utils
libpcre3-dev			pcre-devel
libyaml-dev			libyaml-devel
libmagic-dev			file-devel
liblua5.1-0-dev			lua-devel
libssl-dev			openssl-devel
zlib1g-dev			zlib-devel
lm-sensors			lm_sensors
ifenslave			iputils
ntpdate				ntp
redis-server			redis
libperl-dev			perl-devel
libjpeg-turbo8-dev		libjpeg-turbo-devel
libfreetype6-dev		freetype-devel
iproute2			iproute
iputils-ping			iputils
ifupdown			NetworkManager
net-tools			net-tools
libpython3.8-dev		python3-devel
mysql-server			mysql5-server
libmysqlclient-dev		mysql5-devel
tofrodos			dos2unix
				kernel-headers
				kernel-devel
qemu-user-static
initramfs-tools
gcc-5-plugin-dev
build-essential
libprelude-dev
libzmq3-dev
libhtp-dev
fbset				maybe in xorg-x11-server

deprecated in ubuntu

1
2
sysv-rc-conf
libjpeg-dev # why?

refer to:
https://blog.csdn.net/mimosa2008/article/details/102833837
https://forums.centos.org/viewtopic.php?t=14711
https://blog.csdn.net/xldwhj/article/details/72831674
https://www.cnblogs.com/orcl-2018/p/13276558.html
https://blog.csdn.net/HAOMCU/article/details/7268687
https://mirrors.tuna.tsinghua.edu.cn/help/fedora/