Category Archives: Linux
Port forward port 22 into WSL ubuntu
Run this command in windows host 2024/11/19
Resolved: unable to push to gitlab
if you meet this problem: fatal: the remote end hung up unexpectedly Do this: 2024/10/31
Remove old node_modules
2024/08/08
Install apache and php for http research
I need a super clean apache and forward all PHP requests to a independent php-cgi process which host by a specific port 1. Install Apache Mac In ubuntu, no need to build apache from source, just “sudo apt-get install apache2” Linux 2. Install PHP Mac Linux if you meet this error “configure: error: re2c 1.0.3 […] 2024/03/30
ubuntu , allow root to login mysql without sudo
2024/03/03
Simplest guide to config tomcat to use https with lets encrypt’s free cert
Support you have generate a standalone cert using certbot command, and your cert is in /etc/letsencrypt/live/ . If not, follow this https://www.digitalocean.com/community/tutorials/how-to-use-certbot-standalone-mode-to-retrieve-let-s-encrypt-ssl-certificates-on-ubuntu-16-04 Execute openssl command and remember your password Edit tomcat’s conf/server.xml, you just need one connector to serve 8443, no need other conntector Restart your tomcat, it is done. Below is the virtualhost to […] 2019/11/23
Bash script to create a file with increment bytes
for ((x=0;x<=255;x++)); do a=`echo “obase=16; $x”|bc`;echo -n -e “\x$a”; done 2019/09/08
Php example to read all tweets for a specific user
2019/01/27
Godaddy cheap VPS之經驗
係Godaddy起左隻最Cheap VPS, $160蚊個月, 得一粒vcore同1GB Ram, 行ubuntu + mysql + apache + wordpress. 正常黎講要兩三個星期restart一次mysql因為out of memory. 行wordpres兩年之後response time趑黎越慢, 有成十秒先load到個page. 裝左W3 Total Cache之後快左好多, 一兩秒就load到, 建議大家一定要裝. 2018/11/28
放工去圖書館之Redis
2018/06/05
linux elf dependency graph
linux elf dependency graph 2016/05/18
Linux view csv command
alias csv=’column -s, -t’ csv your_file 2015/06/16
objdump 2.24 has bug
objdump 2.24 has bug, but this bug is fixed in 2.25. It dump the wrong address for my 32 bits kernel. 2015/05/22
ubuntu 12.04 vnc startup script for fallback mode
2015/03/21
Fixed ubuntu vnc keymap problem
ubuntu 12.04 vnc keymap has trouble, D become minimize all windows and S become start menu, run these to fix it. 2015/03/19
tomcat auto startup script
just save this to /etc/init.d/tomcat and link to /etc/rc5.d/S99tomcat 2015/01/21
disable gnome “unable to mount…” dialog
gsettings set org.gnome.desktop.media-handling automount false …and enable it again: gsettings set org.gnome.desktop.media-handling automount true 2015/01/14
why i receive zero in my socket
I have two programs, one written in c++, the other is in java. C++ keep sending bytes to java, overtime write out 400KB. Java keep receiving the data using the readBytes function, this function returns an integer which is the number of byte it actually read for the function call. For every send (400kb) in […] 2015/01/08
[solved] usb wireless mouse freeze periodically in ubuntu 12.04 lts
usb wireless mouse freeze periodically in ubuntu 12.04 lts, edit /boot/grub/grub.cfg, add a boot option irqpoll will fix it 2014/08/24
Add tabIndex to all tag incrementally
in VI, there is a command to add tabIndex to all tag incrementally :let i=200 | g/ 2014/08/23
We should mix 4K and 4M Page
I was fixing the PSE and PAE page table display for GKD, I found out Linux using 4M page to map large address space and it uses 4K page to map broken space. So advance OS should mix use of 4K and 4M page. Now GKD supports PSE=1 (4M page) 2014/07/27
I think i am under dns attack
I think i am under dns attack, in my /var/log/message i keep seeing these. Someone is using over 2000 ip to lookup my dns server. 2014/07/12
My new server
Just bought a 2nd hand HP server (8core + 16GB ram), cost me $2630 HKD. One 1TB 2.5″ hard disk cost me $450. Total $3080. It reboot only take 20 seconds, dell needs 5 mins (CRAZY!!!) 2014/05/20
Analyst android ELF dependency-graph by elf-dependency-walker
Someone asked me in email about using elf-dependency-walker to analyst library or executable in linux. I found out android is using ELF format for its libraries or executables too. So the rest is simple. Please download the android emulator, within the directory there is the system image, which contain the file system. You can see in […] 2014/05/13
solved : compile error in ffmpeg “error: invalid combination of opcode and operands”
I am using ubuntu 12.04 64 bits and trying compile ffmpeg and got this error: libavfilter/x86/vf_pullup.asm:59: error: invalid combination of opcode and operands libavfilter/x86/vf_pullup.asm:138: error: invalid combination of opcode and operands libavfilter/x86/vf_pullup.asm:175: error: invalid combination of opcode and operands To solve this, add “–disable-mmx” to your ./configure 2014/05/13
sox and ffmpeg (convert hls into live hls) usage
These are the basic usage of SOX This script will convert ffmpeg HLS into “live streaming HLS” The above script has to run with ffmpeg: /root/download/ffmpeg-2.1.4/ffmpeg -f alsa -ac 2 -i hw:0,0 -strict experimental -acodec libmp3lame -map 0 -f segment -segment_list out.m3u8 -segment_format libmp3lame -segment_time 0.5 -segment_list_flags +live ‘a%05d.mp3’ 2014/05/08
filter port in httpd.conf
2014/05/03
A very professional ppt that talk about system performance tuning
A very professional ppt that talk about system performance tuning download : scalelinuxperformance-130224171331-phpapp01 2013/04/17
How to use QMP, send command remotely to qemu
To use qmp and send command to qemu from another process, start qemu by This will create a file /tmp/test.gmp for interchange the command. Then you can start another terminal and invoke command.txt: !!! remark, must invoke { “execute”: “qmp_capabilities” } before invoke any qmp command 2013/03/20
PSI probe for tomcat can’t generate chart
Add this “CATALINA_OPTS=-Djava.awt.headless=true” to catalina.sh 2013/01/31
How to change Fedora’s font rendering to get an Ubuntu-like result
Font rendering is a matter of taste. However, I personally think Ubuntu’s default font rendering is the most eye-pleasing one of the whole Linux eco-system. And if a website’s CSS font stack is looking good on Ubuntu, you can be relatively sure that it also works for Mac or MS Windows as long as the used fonts are available on these […] 2012/12/13