View gist:f74f0e261c563c2e9b7fee0a61f2a811
package main
import (
"bufio"
"flag"
"fmt"
g "github.com/golang/glog"
p "github.com/ls0f/proxylib"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/terminal"
View install_jenkins_plugin.sh
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
View parse.py
#coding:utf-8
import re
class Parse(object):
def __init__(self):
self.i = -1
self.text = ""
self.js = None
View cal.py
#coding:utf-8
'''
expr ::= term { (+|-) term }*
term ::= factor { (*|/) factor }*
factor ::= ( expr )
| NUM
View tail.py
import os
import time
import sys
class Tail(object):
def __init__(self, file_name):
self.filename = file_name
self.pos = 0
View proxy.go
package main
import (
"net"
"fmt"
"io"
"os"
)
func main() {
if len(os.Args) != 3 {
fatal("usage: netfwd local remote")
View arp.py
#coding:utf-8
import socket
import time
import os
import sys
from struct import pack
ARPOP_REQUEST = pack('!H', 0x0001)
ARPOP_REPLY = pack('!H', 0x0002)
View img2txt.js
var cv = document.getElementById('cv');
var c = cv.getContext('2d');
var txtDiv = document.getElementById('txt');
var fileBtn = document.getElementById("up-button");
var img = new Image();
img.src = 'a.jpg';
img.onload = init; // 图片加载完开始转换
fileBtn.onchange = getImg;
// 根据灰度生成相应字符
View int2bin.py
def int2bin(num):
s = ''
while num > 0:
s = ('1' if num & 1 else '0') + s
num >>= 1
return s if s else '0'
if __name__ == "__main__":
assert int2bin(12345) == bin(12345)[2:]
View .tmux.conf
#此类配置可以在命令行模式中输入show-options -g查询
set-option -g base-index 1 #窗口的初始序号;默认为0,这里设置为1
set-option -g display-time 5000 #提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set-option -g repeat-time 1000 #控制台激活后的持续时间;设置合适的时间以避免每次操作都要先激活控制台,单位为毫秒
set-option -g status-keys vi #操作状态栏时的默认键盘布局;可以设置为vi或emacs
set-option -g status-right "#(date +%H:%M' ')" #状态栏右方的内容;这里的设置将得到类似23:59的显示
set-option -g status-right-length 10 #状态栏右方的内容长度;建议把更多的空间留给状态栏左方(用于列出当前窗口)
#set-option -g status-utf8 on 开启状态栏的UTF-8支持
#此类设置可以在命令行模式中输入show-window-options -g查询