This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 修改默认 shell | |
set-option -g default-shell /bin/zsh | |
# 启用终端 256 色 | |
set -g default-terminal "screen-256color" | |
# 状态栏编码 | |
set -g status-utf8 on | |
# 状态栏前景色背景色 | |
set -g status-fg white | |
set -g status-bg cyan | |
# 状态栏高亮 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InfiniteDict = lambda: defaultdict(InfiniteDict) # noqa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
from bintrees.rbtree import RBTree | |
from types import GeneratorType | |
def md5(data: str) -> int: | |
"""md5 util function""" | |
return int(hashlib.md5(data.encode('utf-8')).hexdigest(), 16) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'dd if=/dev/urandom bs=1 count=%d 2>/dev/null' % size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'http://wlkt.nuist.edu.cn/(S(qfgpjnudhjyxvpnidq2zeu45))/' | |
def get_checkcode(): | |
res = requests.head(url + 'yzm.aspx') | |
return res.cookies['checkcode'] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count(s, sub): | |
result = 0 | |
for i in range(len(s) + 1 - len(sub)): | |
result += (s[i:i + len(sub)] == sub) | |
return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eo pipefail | |
# hello-world latest ef872312fe1b 3 months ago 910 B | |
# hello-world latest ef872312fe1bbc5e05aae626791a47ee9b032efa8f3bda39cc0be7b56bfe59b9 3 months ago 910 B | |
# debian latest f6fab3b798be 10 weeks ago 85.1 MB | |
# debian latest f6fab3b798be3174f45aa1eb731f8182705555f89c9026d8c1ef230cbf8301dd 10 weeks ago 85.1 MB | |
if ! command -v curl &> /dev/null; then | |
echo >&2 'error: "curl" not found!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERSION=$(echo "${GIT_BRANCH:7:7}-${GIT_COMMIT:0:7}" | sed "s/\//-/g") | |
echo "VERSION: $VERSION" | |
sed "s/VERSION=[^0-9.]*\([0-9.]*\).*/VERSION=$VERSION/" Makefile.var |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files=$(find . -name '*.xml' | xargs egrep '[a-z].* $' |cut -d : -f 1|uniq) | |
if [ -z "$files" ]; then | |
exit 0 | |
fi | |
echo "====== GIT PRE COMMIT HOOK ======" | |
echo "following file contains trailing whitespace:" | |
echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use libc; | |
use std::ffi::CString; | |
use std::mem::transmute; | |
use std::os::raw::c_char; | |
use std::os::raw::c_int; | |
use std::os::raw::c_void; | |
#[no_mangle] | |
extern "C" fn strcmp(s1: *const c_char, s2: *const c_char) -> c_int { | |
println!("strcmp"); |