Skip to content

Instantly share code, notes, and snippets.

:shipit:
Focusing

Fan Zhang zh-f

:shipit:
Focusing
Block or report user

Report or block zh-f

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zh-f
zh-f / Retry.java
Created Apr 25, 2019 — forked from dtodt/Retry.java
Retrofit2@2.5.0 - Retry Adapter Factory - Call & CompletableFuture
View Retry.java
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 Feb 13, 2019 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX
View rm_mysql.md

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
    
View Set rz & sz on mac.md

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.
View write-mime-multipart
#!/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 Jun 26, 2018 — forked from ameizi/linux-http-tcp.md
linux下查看http 并发和 tcp连接数
View linux-http-tcp.md

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 — forked from jbub/squash-commits.sh
git squash last two commits into one
View squash-commits.sh
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 — forked from jriguera/segurity_group_rules.sh
Neutron cmd to add security group rules
View segurity_group_rules.sh
# 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 \
View tsinghua-pip-mirror.md

OS

Linux

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

Windows

%APPDATA%\pip\pip.ini

View installing-sshpass-on-mac
Just use brew
$brew install http://git.io/sshpass.rb
@zh-f
zh-f / install-tmux
Last active Apr 8, 2019 — forked from relaxdiego/install-tmux
Install tmux 2.6 on CentOS 7.1
View install-tmux
# 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
You can’t perform that action at this time.