Skip to content

Instantly share code, notes, and snippets.

Waiting for autumn

Wang Dàpéng wong2

Waiting for autumn
View GitHub Profile
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 ~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
wong2 /
Last active Aug 29, 2015
import re
import time
import json
import requests
from random import choice
code_url = '{phone}&callback=callback'
wong2 / cmds.txt
Last active May 2, 2021
在任意聊天中输入。 [ ]表示后面要跟一个空格(可能还需要别的参数才能生效)
View cmds.txt
wong2 /
Created Mar 18, 2015
import os
import re
import sys
import requests
from gevent import monkey
from gevent.pool import Pool
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:
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)
# -*- coding: utf-8 -*-
core module, defines some extension instances etc.
from flask_sqlalchemy import SQLAlchemy
#: Flask-SQLAlchemy extension instance
db = SQLAlchemy()
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.
wong2 / 抓毛毛
Last active Dec 27, 2015
View 抓毛毛
!function() {
var getLottery = function() {
var url = '';
url += 'c24291a8ab24d18cd51be92e4b2eecce';
url += '&ruleId=1111';
url += '&RandomNum=' + new Date().getTime();
url += '&ua=' + encodeURIComponent(ua);
url += '&d=m';{
wong2 /
Created Aug 3, 2013
flask jsonify decorator
import json
# jsonify response decorator
def jsonify(f):
def wrapped(*args, **kwargs):
return Response(json.dumps(f(*args, **kwargs)), mimetype='application/json')
return wrapped