Skip to content

Instantly share code, notes, and snippets.

View scturtle's full-sized avatar
🐢

scturtle

🐢
View GitHub Profile
@scturtle
scturtle / gist:4267659
Created December 12, 2012 13:17
weixin(WeChat) bot by python on heroku
# coding: utf-8
from __future__ import division
import re
import os
import time
import bottle
from xml.dom.minidom import parseString
from math import *
helpstr = '''\
@scturtle
scturtle / scan.py
Last active December 10, 2015 01:19
scan and generate static html files
#!/bin/env python3
import sys
if sys.version_info.major == 2:
print ('SORRY: scan.py works under python 3.')
exit(1)
from pathlib import Path
struct = '''\
<!doctype html>
@scturtle
scturtle / maildog.pyw
Last active December 8, 2018 04:42
a mail checker on the system tray (pyqt)
# coding: utf-8
import logging
import os, sys, json
from PyQt4 import QtGui
from PyQt4.QtCore import QTimer
import imaplib, StringIO, rfc822
from email.Header import decode_header
_config = json.load(open('config.json')) # server, user, pasw
locals().update(_config)
@scturtle
scturtle / subber.py
Last active December 10, 2015 03:58
wild subber 野生字幕君
#!/usr/bin/env python
# coding: utf-8
import re
import os
import sys
import time
import bisect
import threading
subs = []
@scturtle
scturtle / getsub.py
Created December 29, 2012 15:03
get subtitles on Mac
#!/usr/bin/env python
import os
import sys
# sscl from http://hg.splayer.org/splayerx/raw/0b9e84441210/binaries/x86_64/sscl
mv = sys.argv[1]
out = os.popen('sscl --pull --video-file "{}"'.format(mv)).read()
print out
for sf in out.splitlines():
#!/usr/bin/env python
# coding: utf-8
import json
import urllib2
from os import system, popen
# generate speech audio file with 'say' in osx and ffmpeg
words = 'Hello world.'
system('say "{}" -o say.aiff'.format(words))
system('ffmpeg -i say.aiff say.flac -loglevel quiet -y')
@scturtle
scturtle / oauth.py
Last active December 11, 2015 19:18
simple OAuth 1.0
# coding: utf-8
# ref: https://github.com/FanfouAPI/FanFouAPIDoc/wiki/Oauth
# http://open.weibo.com/wiki/OAuth
import os
import json
import random
import requests
import webbrowser
from time import time
from urllib import quote_plus
@scturtle
scturtle / mytemplate.tex
Last active December 11, 2015 20:18
steal book from reader.douban.com
// step 1
var content=$('.info')[0].innerHTML;
var last='';
var observer = new MutationObserver(function(e) {
var c=$('.inner .content:first')[0].innerHTML;
if(c!=last){
last = c;
content = content + '\n\n' + c;
$('.page-next').click();
}
@scturtle
scturtle / gist:5044337
Created February 27, 2013 02:11
twitter instagram preview (greasemonkey)
// ==UserScript==
// @name twitter instagram previewer
// @namespace http://scturtle.me/
// @version 1
// @match https://twitter.com/*
// @require http://code.jquery.com/jquery.min.js
// @require http://www.jqui.net/demo/mutate/mutate.events.js
// @require http://www.jqui.net/demo/mutate/mutate.min.js
// ==/UserScript==
@scturtle
scturtle / rr.py
Created February 27, 2013 06:51
timeline of any user in renren.com
# coding: utf-8
from __future__ import unicode_literals
import re
import sys
import requests
import HTMLParser
cookie_t = ''
uid = ''
filename = ''