Skip to content

Instantly share code, notes, and snippets.

@scateu
scateu / gist:5883144
Last active December 19, 2015 02:29
THUTreehole_auto
# -*- coding:utf-8 -*-
import urllib2
import urllib
import cookielib
import httplib
import linecache
import random
def Say(words):
print words
绝代有佳人,幽居在空谷。
自云良家子,零落依草木。
关中昔丧乱,兄弟遭杀戮。
官高何足论,不得收骨肉。
世情恶衰歇,万事随转烛。
夫婿轻薄儿,新人美如玉。
合昏尚知时,鸳鸯不独宿。
但见新人笑,那闻旧人哭!
在山泉水清,出山泉水浊。
侍婢卖珠回,牵萝补茅屋。
@scateu
scateu / nalus.py
Created October 10, 2013 02:16 — forked from nvloff/nalus.py
import base64
import sys
def get_nalus(file_name, count):
bitstream = open(file_name, "rb")
data = bitstream.read(count*3000)
data = base64.b16encode(data)
nalus = data.split('00000001')
for nalu in nalus[1:count+1]:
nalu_t = int(nalu[0:2],16) & int('1f',16)
@scateu
scateu / github.css
Created February 13, 2014 03:05 — forked from theconektd/github.css
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@scateu
scateu / UTF8PlayGround-Result.txt
Last active May 13, 2017 07:11
一个简单的UTF8/GBK/Unicode转换示例
Unicode: u'\u4e00'
UTF-8: '\xe4\xb8\x80'
GBK: '\xd2\xbb'
********************
Unicode: u'\u9fa5'
UTF-8: '\xe9\xbe\xa5'
GBK: '\xfd\x9b'
********************
@scateu
scateu / update-dnspod-ddns.sh
Last active October 15, 2016 23:46
Dnspod DDNS
# 1. Generate an API Token from dnspod.cn
# 2. create a record first
# 3. change $TMP_FILE
# 4. get your $DOMAIN_ID
# 5. change $NEW_IP generation method.
# 6. sudo apt-get install jq
TOKEN=12345,1234567890abcdef1234567890abcdef #TODO: change this TOKEN.
TMP_FILE=/tmp/scateu.me.list #TODO
@scateu
scateu / convert-taskpaper-to-eml.py
Last active May 11, 2020 16:24
Convert todo.txt or Taskpaper(Omnifocus) to .eml file. Then import into alpine.
# -*- coding: utf-8
"""
Manually Pre-process
## Omnifocus 拷贝为Taskpaper
把Taskpaper转成Todo.txt
VIM COMMANDS:
:%g/^$/d
@scateu
scateu / youtube-dl-audio-very-fast.sh
Last active September 13, 2018 02:54
youtube-dl-audio-very-fast.sh
trap abort SIGINT
abort() {
echo "Abort."
exit
}
timelimit -p -t20 -T10 youtube-dl --proxy socks5://localhost:1080 -f bestaudio $1
RET=$?
while [ $RET -ne 0 ]
do
@scateu
scateu / gist:695adcb37a563489832516dcb26283c5
Created February 11, 2019 06:49
十分凶残的feed to maildir
while read LINE
do
NAME=$(echo "$LINE" | cut -d, -f1)
URL=$(echo "$LINE" | cut -d, -f2)
wget --timeout=4 --tries=2 --retry-connrefused $(echo $URL | tr -d '"') -O - | feed2maildir -s -m ~/mail/feeds/ -n "$NAME" &
done < ~/.feeds
# http://chriswarbo.net/blog/2017-01-14-rss_to_maildir.html
CUTTER = python3 jumpcutter/jumpcutter.py
%_0.3.mp4: %.mkv
ffmpeg -i $< -c:v copy $(basename $<).mp4
if [ -d ./TEMP ]; then rm -r ./TEMP; fi
${CUTTER} --silent_threshold 0.3 --input_file $(basename $<).mp4 --output_file $(basename $<)_0.3.mp4
%_wechat.mp4: %_0.3.mp4
ffmpeg -i $< -c copy -t 00:05:00.00 $@
%_0.1.mp4 %_0.2.mp4 %_0.3.mp4: %.mp4
if [ -d ./TEMP ]; then rm -r ./TEMP; fi