Skip to content

Instantly share code, notes, and snippets.

View qizhihere's full-sized avatar

littleqz qizhihere

  • WuHan, Hubei Province, China
View GitHub Profile
@qizhihere
qizhihere / tmux_install.sh
Last active October 14, 2016 13:06 — forked from P7h/tmux__CentOS__build_from_source.sh
tmux 2.0 and tmux 2.3 installation steps for Ubuntu
# tmux v2.3 installation steps for Ubuntu [various OS versions]
sudo apt-get update -yqqu
sudo add-apt-repository -y ppa:pi-rho/dev
sudo apt-get update -yqqu
sudo apt-get install -yqqu python-software-properties software-properties-common
sudo apt-get install -yqq tmux-next=2.3~20160913~bzr3547+20-1ubuntu1~ppa0~ubuntu16.04.1
# sudo apt-get install -yqq tmux-next=2.3~20160913~bzr3547+20-1ubuntu1~ppa0~ubuntu15.10.1
# sudo apt-get install -yqq tmux-next=2.3~20160913~bzr3547+20-1ubuntu1~ppa0~ubuntu15.04.1
# sudo apt-get install -yqq tmux-next=2.3~20160913~bzr3547+20-1ubuntu1~ppa0~ubuntu14.04.1
@qizhihere
qizhihere / gist:351ffdba62f6f2737dc742240af6b243
Created July 7, 2016 12:51 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@qizhihere
qizhihere / README.md
Last active November 13, 2015 09:05 — forked from chuangbo/README.md
Python dynamic DNSPod DNS Script

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔60秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_password=xxx&domain_id=xxx"

@qizhihere
qizhihere / time_ago.php
Last active September 7, 2015 06:43 — forked from hubsgz/convert2timeago.php
convert timestamp to N days/hours/minutes/seconds ago
function time_ago($timestamp, $lang='cn')
{
$msg = [
'cn' => [
'day' => '天前',
'hour' => '小时前',
'minute' => '分钟前',
'second' => '秒前',
],
'en' => [
#this script can never fail
#i use it in the fish_config
#call it with start_agent
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null
@qizhihere
qizhihere / mov2gif
Last active August 29, 2015 14:23 — forked from artursapek/mov2gif
#!/bin/bash
# mov2giv in out width
# mov2gif video_file_in.mov gif_file_out.gif 300
tmp_dir=/tmp/frames_$(date +%s)
mkdir $tmp_dir
if [ -z "$3" ]
then
size=600
@qizhihere
qizhihere / gist:d10ab6d78fad41227d0e
Last active August 29, 2015 14:22 — forked from klovadis/gist:2549131
use optional args in node.js
// example function where arguments 2 and 3 are optional
function example( err, optionalA, optionalB, callback ) {
// retrieve arguments as array
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
// first argument is the error object
@qizhihere
qizhihere / install-tmux
Last active August 29, 2015 14:19 — forked from rothgar/install-tmux
install tmux 1.9a on centos 6.5
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL 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