Skip to content

Instantly share code, notes, and snippets.

@usufu
usufu / expecting.md
Created March 14, 2016 07:34 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@usufu
usufu / serverspeeder-all.sh
Created March 7, 2016 05:24 — forked from rptec/serverspeeder-all.sh
锐速破解版一键安装。
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
#定义变量
#授权文件自动生成url
APX=http://soft.91yun.org/soft/serverspeeder/apx1.php
#安装包下载地址
INSTALLPACK=http://soft.91yun.org/soft/serverspeeder/91yunserverspeeder.tar.gz
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
username = '' ###账号###
password = '' ###密码###
login_url = 'http://v2ex.com/signin' ###如V2EX设置了使用 SSL,必须改 https###
index_url = 'http://v2ex.com' ###同上###
mission_url = 'http://www.v2ex.com/mission/daily' ###同上###
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \
@usufu
usufu / gpg
Last active December 23, 2015 16:09
Resolve the GPG error when apt-get update
gpg --keyserver subkeys.pgp.net --recv 40976EAF437D05B5
gpg --export --armor 40976EAF437D05B5 | sudo apt-key add -
http://forum.ubuntu.org.cn/viewtopic.php?t=378189
@usufu
usufu / atttmux
Created September 4, 2013 08:16
mismatch server version and client for tmux, especially when you upgrade your tmux, but session not killed.
$ pgrep tmux
3429
$ /proc/3429/exe attach
@usufu
usufu / tmux1.8
Created September 4, 2013 08:12
tmux1.8
sudo add-apt-repository ppa:pi-rho/dev (source)
sudo apt-get update (freshens the cache/database of packages)
sudo apt-cache show tmux (*optional, shows you available versions, 1.7 & 1.8 should be listed)
sudo apt-get install tmux
tmux -V
@usufu
usufu / dateupdate
Created September 2, 2013 09:45
update time through http.
sudo date -s "$(wget -S "http://www.google.com/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
@usufu
usufu / vim7.4
Created August 31, 2013 15:31
How To Install Vim 7.4 On Ubuntu 13.10, 13.04, 12.04, Linux Mint 16, 15, 13 And Debian Sid
$ sudo add-apt-repository ppa:fcwu-tw/ppa
$ sudo apt-get update
$ sudo apt-get install vim