Skip to content

Instantly share code, notes, and snippets.

View altair21's full-sized avatar

Bohao Chen altair21

View GitHub Profile
@altair21
altair21 / tmux-cheatsheet.markdown
Created January 18, 2017 10:38 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@altair21
altair21 / embed.js
Created November 9, 2016 04:39
多说 UA
//HelloDog - http://wsgzao.github.io/post/duoshuo/
//More info: http://moxfive.xyz/2015/09/29/duosuo-style
//移动客户端判断开始
function checkMobile() {
var isiPad = navigator.userAgent.match(/iPad/i) != null;
if (isiPad) {
return false;
}
var isMobile = navigator.userAgent.match(/iphone|android|phone|mobile|wap|netfront|java|opera mobi|opera mini|ucweb|windows ce|symbian|symbianos|series|webos|sony|blackberry|dopod|nokia|samsung|palmsource|xda|pieplus|meizu|midp|cldc|motorola|foma|docomo|up.browser|up.link|blazer|helio|hosin|huawei|novarra|coolpad|webos|techfaith|palmsource|alcatel|amoi|ktouch|nexian|ericsson|philips|sagem|wellcom|bunjalloo|maui|smartphone|iemobile|spice|bird|zte-|longcos|pantech|gionee|portalmmm|jig browser|hiptop|benq|haier|^lct|320x320|240x320|176x220/i) != null;
if (isMobile) {
@altair21
altair21 / Typeahead-BS3-css.css
Created November 7, 2016 10:02 — forked from mixisLv/Typeahead-BS3-css.css
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;
font-size: 14px;
// Removed IE support in this demo for the sake of simplicity
(function() {
if (!sessionStorage.length) {
// Ask other tabs for session storage
localStorage.setItem('getSessionStorage', Date.now());
};
// Core
window.addEventListener('storage', function(event) {
if (event.key == 'getSessionStorage') {
// Some tab asked for the sessionStorage -> send it
step1——找到本地镜像的ID:docker images
step2——登陆Hub:docker login --username=username --password=password --email=email
step3——tag:docker tag <imageID> <namespace>/<image name>:<version tag eg latest>
step4——push镜像:docker push <namespace>/<image name>
@altair21
altair21 / 18x-spider.py
Last active August 28, 2016 16:13
18x-spider
#coding=utf-8
import urllib2
import re
import os
savePath = os.path.join(os.getcwd(), 'xImages')
def start(url):
page = urllib2.urlopen(url)
html = page.read()
reg = r'<a class="movie-box" href=".*">'
@altair21
altair21 / addLoadEvent.js
Last active August 18, 2016 04:34
《DOM Scripting》 suggest function
//add function to run after windown.onload
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}