Skip to content

Instantly share code, notes, and snippets.

View able8's full-sized avatar

Able Lv able8

View GitHub Profile
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jedy
jedy / tc.sh
Created May 24, 2012 02:35
tc带宽控制
#!/bin/bash
#脚本文件名: tc2
#########################################################################################
#用TC(Traffic Control)解决ADSL宽带速度技术 Ver. 1.0 by KindGeorge 2004.12.27 #
#########################################################################################
#此脚本经过实验通过,更多的信息请参阅http://lartc.org
#tc+iptables+HTB+SFQ
#
#一.什么是ADSL? ADSL(Asymmetric Digital Subscriber Loop,非对称数字用户环路)
#用最简单的话的讲,就是采用上行和下行不对等带宽的基于ATM的技术.
@rchampourlier
rchampourlier / lazy_script.scpt
Created May 26, 2012 14:24
AppleScript for lazy developer on a Mac: opens multiple terminal tabs, run a set of commands on each tab
-- This script...
-- It assumes when you ssh into the vagrant box you automatically cd into
-- the project's directory (by having a `cd /vagrant` within your
-- `~/.bashrc` for example)
using terms from application "Terminal"
tell application "Terminal"
activate
-- open the terminal's window, set its dimensions
@lanhao34
lanhao34 / test.py
Created August 9, 2012 09:58
pyquery :contains error
# -*- coding: utf-8 -*-
import urllib
from pyquery import PyQuery as pq
import sys
import re
keyword="黑魔女学园 720P TSDM"
s_utf=keyword#.decode(sys.stdin.encoding).encode("utf-8")
url_str='http://bt.ktxp.com/search.php?keyword=%s'%urllib.quote(s_utf)
d = pq(url=url_str)
@jednano
jednano / gitcom.md
Last active May 31, 2023 08:23
Common git commands in a day-to-day workflow

Git Cheat Sheet

Initial Setup

Create an empty git repo or reinitialize an existing one

git init
:%s/r//g 删除DOS方式的回车^M
:%s= *$== 删除行尾空白
:%s/^(.*)n1/1$/ 删除重复行
:%s/^.{-}pdf/new.pdf/ 只是删除第一个pdf
:%s/<!--_.{-}-->// 又是删除多行注释(咦?为什么要说「又」呢?)
:g/s*^$/d 删除所有空行 :这个好用有没有人用过还有其他的方法吗?
@jbgo
jbgo / Vagrantfile
Created August 18, 2013 20:51
Getting started with ansible on OS X
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.ssh.forward_agent = true
@JalfResi
JalfResi / revprox.go
Last active May 31, 2024 13:28
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@dongguosheng
dongguosheng / crawler.py
Last active August 2, 2017 09:21
A simple crawler based on requests and pyquery.
# -*- coding: utf-8 -*-
'''
1. Construct the url with num_iid, eg: http://a.m.tmall.com/i15110720150.htm, 15110720150 is the num_iid.
2. Get the html text.
3. Parse the img urls and insert the num_iid and img urls into sqlite.
'''
import requests
from pyquery import PyQuery as pq