Skip to content

Instantly share code, notes, and snippets.

View scturtle's full-sized avatar
🐢

scturtle

🐢
View GitHub Profile
@scturtle
scturtle / xml2srt.py
Created October 11, 2011 02:59
download ml-class subtitles and convert to srt
# coding: utf-8
import os,sys,re,codecs
limit=[60,60,60,1000]
def xml2srt(fi,fo):
data=''.join((fi.read().split('\n')[9:-4])).strip().split('</p>')
for i in range(0,len(data)-1):
#print i,data[i]
if data[i]:
st_st=data[i].index('"')
@scturtle
scturtle / .vimrc
Created January 5, 2012 08:31
vimrc for imac
" configure vundle
set nocompatible " be iMproved
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'The-NERD-Commenter'
Bundle 'taglist.vim'
Bundle 'Conque-Shell'
@scturtle
scturtle / douban_album_download.py
Created February 6, 2012 02:05
Download DoubanFM favourite songs
# coding: utf-8
import os, urllib, urllib2, re, json
baseurl = 'http://douban.fm/j/mine/playlist?type=n&h=&channel=0&context=channel:0|subject_id:%s'
musicdir = os.path.abspath('./music')
num_pattern = re.compile(r'(\d+)')
def get_json_by_album(href):
''' get direct url of songs by album url '''
@scturtle
scturtle / sub.py
Created March 8, 2012 05:54
get subtitles of coursera classes
import os, urllib2
game_cookie = 'csrf_token=XXXX; session=XXXX;'
class Sub_downloader:
def __init__(self, cookie):
self.cookie = cookie # 'csrf_token=XXXX; session=XXXX;'
def getname(self, response):
@scturtle
scturtle / reeeder.css
Created April 24, 2012 02:17
reeeder for stylish
/*
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document regexp('https?://www\\.google\\.com/reader/view.*') {
*/
/* 正文变大 */
#viewer-container {
font-size: 130% !important;
}
/* 增高的条目栏的源和时间的微调 */
@scturtle
scturtle / gist:2575752
Created May 2, 2012 10:23
game theory note

Game Theory Class on Coursera

chapter 1

  • stable pair of pure strategies
  • constant-sum game
  • strictly(weakly) dominant strategy
  • best response
  • pure strategy Nash equilibrium (if $a_i$ a best response to $a_{-i}$ for all i)
@scturtle
scturtle / nt.md
Created May 31, 2012 16:03
Number Theory - Mathematics for Computer Science

Number Theory - Mathematics for Computer Science

Divisibility

整除的性质:

Lemma 23. The following statements about divisibility hold.

  1. If $a\mid b$, then $a\mid bc$ for all $c$.
  2. If $a\mid b$ and $b\mid c$, then $a\mid c$.
@scturtle
scturtle / gist:2969863
Created June 22, 2012 02:30
60-Second Science downloader
# coding: utf-8
import thread, os, urllib, BeautifulSoup, eyeD3, HTMLParser
from datetime import datetime
html_parser = HTMLParser.HTMLParser()
ue = lambda s: html_parser.unescape(s)
soup = None
filename =None
@scturtle
scturtle / gist:3060332
Created July 6, 2012 14:05
python 3 语法变化
@scturtle
scturtle / changemac.sh
Created July 18, 2012 08:45
dropbox cheater (mac)
#!/bin/bash
MAC="00:"`echo $RANDOM | md5 | sed 's/\(..\)/&:/g' | cut -c1-14`
MAC2="00:"`echo $RANDOM | md5 | sed 's/\(..\)/&:/g' | cut -c1-20`
echo $MAC
ifconfig en0 ether $MAC
ifconfig en1 ether $MAC
ifconfig fw0 lladdr $MAC2