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 / doubanfav.py
Created Apr 22, 2011
show all doubanFM favorite songs
View doubanfav.py
# coding: utf-8
import cookielib,urllib2
from cStringIO import StringIO
from pysqlite2 import dbapi2 as sqlite
from BeautifulSoup import BeautifulSoup
# a useful function from others
def sqlite2cookie(filename,host):
con = sqlite.connect(filename)
@scturtle
scturtle / myTimer.py
Created Apr 22, 2011
a timer using Tkinter
View myTimer.py
# coding: utf-8
from Tkinter import *
from threading import Thread
from tkMessageBox import showinfo
import time,tkMessageBox
class Timer(Thread):
over=False
pause=False
def __init__(self,func):
@scturtle
scturtle / firstpinyin.py
Created Apr 22, 2011
return first pinyin letter of chinese word
View firstpinyin.py
# coding: utf-8
a=[ i.decode('utf8').encode('gbk') for i in
['', '', '', '', '', '', '',
'', '', '', '', '', '', '',
'', '', '', '', '', '',
'', '', '', '', '', '',] ]
def firstpy(s,code='utf8'):
s=s.decode(code).encode('gbk')
@scturtle
scturtle / ptcheater.py
Created Apr 22, 2011
a proxy cheating the upload of BT/PT
View ptcheater.py
# -*- coding: utf-8 -*-
import re, time, sys
import socket
import threading
from time import time
from random import random
PORT = 8080
mbps=10
@scturtle
scturtle / zipcomic.py
Created Apr 22, 2011
zip downloaded comics
View zipcomic.py
# coding: utf-8
import os,sys,zipfile
def walkdir(d):
l=os.listdir(d)
nodir=True
for t in l:
p=os.path.join(d,t)
if os.path.isdir(p):
nodir=False
@scturtle
scturtle / gist:959240
Last active Sep 25, 2015
vimperatorrc
View gist:959240
" vim: set ft=vim:
" Vimperator 3.5
source! /Users/scturtle/.vimperatorrc.local
source ~/.vimperator/plugin/pinyin-hints.js
let mapleader=","
" quick jump
noremap <leader>1 :b 1<cr>
@scturtle
scturtle / getsong.py
Created May 17, 2011
get song urls from baidu
View getsong.py
# coding: utf-8
import sys,os,urllib2,xml
from xml.dom import minidom
lc = sys.getfilesystemencoding()
baseurl0="http://box.zhangmen.baidu.com/x?op=7&mode=1&count=1&listid=&title=%s"
baseurl1="http://box.zhangmen.baidu.com/x?op=12&count=1&mtype=4&title=%s"
@scturtle
scturtle / ftpserver.py
Created Jun 20, 2011
simple ftp server by python
View ftpserver.py
#!/usr/bin/env python2
# coding: utf-8
import os,socket,threading,time
#import traceback
allow_delete = False
local_ip = socket.gethostbyname(socket.gethostname())
local_port = 8888
currdir=os.path.abspath('.')
@scturtle
scturtle / .screenrc
Created Jul 19, 2011
screen configuration
View .screenrc
altscreen on
#se the startup message
startup_message off
term linux
##use ` as the Global Key
## escape ``
##set a biger buffer
defscrollback 4096
#
hardstatus alwayslastline
View txt2epub.py
# coding: utf-8
import os
#书籍信息
title='test book'
creator='scturtle'
description='blablablabla'
#章节文件
txtlist=['1.txt','2.txt']
You can’t perform that action at this time.