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 / testlink-xml-to-csv.py
Created July 9, 2022 16:25 — forked from koichirok/testlink-xml-to-csv.py
Small Python 2 script to convert exported TestLink test cases (test suite) to CSV.
@zh-f
zh-f / Retry.java
Created April 25, 2019 08:11 — forked from dtodt/Retry.java
Retrofit2@2.5.0 - Retry Adapter Factory - Call & CompletableFuture
package com.company.retrofit2.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
@zh-f
zh-f / rm_mysql.md
Created February 13, 2019 06:35 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

Set rz and sz on Mac

There are a mess of troubles in sending and receiving files from my macbook to dev server, since I had no permission to excute command scp on dev server. Here is a lightweight, quick, and convenience tools which related with ssh, called lrzsz. lrzsz is a unix communication package providing the XMODEM, YMODEM, ZMODEM file transefer protocol which usually has been already installed in most of servers.

Prerequisites

  • iTerm2 is necessary. [Here][] is the official website.
#!/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
@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]}'
@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 / 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 / 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