Skip to content

Instantly share code, notes, and snippets.

scturtle

Block or report user

Report or block scturtle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@scturtle
scturtle / xml2srt.py
Created Oct 11, 2011
download ml-class subtitles and convert to srt
View xml2srt.py
# 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 Jan 5, 2012
vimrc for imac
View .vimrc
" 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 Feb 6, 2012
Download DoubanFM favourite songs
View douban_album_download.py
# 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 Mar 8, 2012
get subtitles of coursera classes
View sub.py
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 Apr 24, 2012
reeeder for stylish
View reeeder.css
/*
@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
game theory note
View gist:2575752

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
Number Theory - Mathematics for Computer Science
View nt.md

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 Jun 22, 2012
60-Second Science downloader
View gist:2969863
# 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 Jul 6, 2012
python 3 语法变化
View gist:3060332
@scturtle
scturtle / changemac.sh
Created Jul 18, 2012
dropbox cheater (mac)
View changemac.sh
#!/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
You can’t perform that action at this time.