Skip to content

Instantly share code, notes, and snippets.

🍉
Waiting for summer

Wang Dàpéng wong2

View GitHub Profile
View cloudpickle.py
"""
This class is defined to override standard pickle functionality
The goals of it follow:
-Serialize lambdas and nested functions to compiled byte code
-Deal with main module correctly
-Deal with other non-serializable objects
It does not include an unpickler, as standard python unpickling suffices.
View core.py
# -*- coding: utf-8 -*-
"""
core module, defines some extension instances etc.
"""
from flask_sqlalchemy import SQLAlchemy
#: Flask-SQLAlchemy extension instance
db = SQLAlchemy()
@wong2
wong2 / Rational.scala
Created Oct 22, 2014
"Programming Scala" Chapter 6
View Rational.scala
class Rational(n: Int, d: Int) {
require(d != 0)
private val g = gcd(n.abs, d.abs)
val numer: Int = n / g
val denom: Int = d / g
def this(n: Int) = this(n, 1)
@wong2
wong2 / gunicorn_supervisor.conf
Created Dec 9, 2014
Minimal supervisor config file for gunicorn
View gunicorn_supervisor.conf
; Minimal sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
[inet_http_server]
port=127.0.0.1:9001
username=user
password=password
@wong2
wong2 / downlist.py
Created Mar 18, 2015
下载网易云音乐歌单
View downlist.py
#-*-coding:utf-8-*-
import os
import re
import sys
import requests
from gevent import monkey
monkey.patch_all()
from gevent.pool import Pool
@wong2
wong2 / main.py
Last active Aug 29, 2015
遍历友宝免费冰红茶兑换码
View main.py
#-*-coding:utf-8-*-
import re
import time
import json
import requests
from random import choice
code_url = 'http://ama.adwo.com/advmessage/adv/addResultJsonP.action?advid=30345&mobile={phone}&callback=callback'
View .vimrc
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
filetype off
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@wong2
wong2 / sleepsort.py
Created Jun 18, 2011
SleepSort-Python using threading.Timer
View sleepsort.py
from __future__ import print_function
from threading import Timer
l = [8, 2, 4, 6, 7, 1]
for n in l:
Timer(n, lambda x: print(x), [n]).start()
View gist:1318308
#-*-coding:utf-8-*-
from cmd import Cmd
import os
import atexit
from user import User
import getpwd
import sys
# ls
@wong2
wong2 / wong2.js
Created Jan 17, 2012
备份。。
View wong2.js
/**
* Copyright 2011 wong2 <wonderfuly@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
You can’t perform that action at this time.