Skip to content

Instantly share code, notes, and snippets.

@scturtle
scturtle / ftpserver.py
Created June 20, 2011 16:03
simple ftp server by python
#!/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('.')
@sontek
sontek / snowjob.sh
Last active August 9, 2024 13:14
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
@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)
@jbroadway
jbroadway / Slimdown.md
Last active September 4, 2024 10:27
Slimdown - A simple regex-based Markdown parser.
@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 / 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
@lastland
lastland / BeyesianAvg.py
Created August 11, 2012 07:14
尝试用这篇post: http://www.matrix67.com/blog/archives/5044 中的方法实现的一个自动中文抽词算法的Python程序
# -*- coding=utf-8 -*-
import collections
# Usage:
# 我的做法是把WordsDetector.py里的结果输出到文件,
# 然后把文件名放到下面的names列表中,运行本程序。
names = ['name0',
'name1',
'name2',
@scturtle
scturtle / gist:3696493
Created September 11, 2012 06:33
get lyrics from Qianqian
# -*- coding: utf-8 -*-
import urllib, urllib2
import random
import re
from xml.dom import minidom
# Levenshtein Distance
def lev(first, second):
"""Find the Levenshtein distance between two strings."""
if len(first) > len(second):
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@zolunx10
zolunx10 / .gitignore
Last active December 24, 2023 15:14
Rime用颜文字(及符号)字典. 个人都绑定到v键开头了, 请下载kaomoji*并酌情修改字典文件.dict.yaml; 另如果要在当前输入法中直接嵌入, 请参考luna_pinyin_simp.custom.yaml前半段修改您的输入法设置.
*
!.gitignore
!alternative.yaml
!*.custom.yaml
!kaomoji.*.yaml