Skip to content

Instantly share code, notes, and snippets.

View zh-f's full-sized avatar
:shipit:
Focusing

Fan Zhang zh-f

:shipit:
Focusing
View GitHub Profile
@zh-f
zh-f / 1st.md
Created November 2, 2015 09:49
1st Gist

This is a very first try to use Gist

System.out.println("Hello,world!");
@zh-f
zh-f / 1stDayOfAMonth.java
Last active September 1, 2016 01:24
Get 1st day of a month in Java
private Date get1stDateOfCurrentMonth(){
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_MONTH,1);
return c.getTime();
}
@zh-f
zh-f / exp-imp-one-table-in-mysql.md
Created September 1, 2016 05:58
Exporting and importing an individual MySQL table
  • Exporting the Table To export the table run the following command from the command line:
mysqldump -p --user=username dbname tableName > tableName.sql

This will export the tableName to the file tableName.sql.

  • Importing the Table To import the table run the following command from the command line:
@zh-f
zh-f / install-tmux
Last active July 21, 2022 17:23 — forked from relaxdiego/install-tmux
Install tmux 2.6 on CentOS 7.1
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
make
sudo make install
Just use brew
$brew install http://git.io/sshpass.rb

OS

Linux

$ vim ~/.config/pip/pip.conf
or $ vim ~/.pip/pip.conf

Windows

%APPDATA%\pip\pip.ini

@zh-f
zh-f / segurity_group_rules.sh
Created May 15, 2018 03:02 — forked from jriguera/segurity_group_rules.sh
Neutron cmd to add security group rules
# Add Neutron security groups for ping and ssh
neutron security-group-rule-create \
--protocol icmp \
--direction ingress \
--remote-ip-prefix 0.0.0.0/0 \
default
neutron security-group-rule-create \
--protocol tcp \
@zh-f
zh-f / squash-commits.sh
Created May 21, 2018 06:34 — forked from jbub/squash-commits.sh
git squash last two commits into one
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c
@zh-f
zh-f / linux-http-tcp.md
Created June 26, 2018 01:04 — forked from v5tech/linux-http-tcp.md
linux下查看http 并发和 tcp连接数

linux查看httpd进程数

ps -ef | grep httpd | wc -l

查看Apache的并发请求数及其TCP连接状态

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
#!/usr/bin/python
# largely taken from python examples
# http://docs.python.org/library/email-examples.html
import os
import sys
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart