Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wong2's full-sized avatar
🍃
Waiting for autumn

wong2 wong2

🍃
Waiting for autumn
View GitHub Profile
@wong2
wong2 / cloudpickle.py
Created February 28, 2014 08:53
存一份
"""
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.
# -*- 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 October 22, 2014 10:02
"Programming Scala" Chapter 6
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 December 9, 2014 05:56
Minimal supervisor config file for gunicorn
; 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 March 18, 2015 06:51
下载网易云音乐歌单
#-*-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 / cmds.txt
Last active May 2, 2021 12:13
在任意聊天中输入。 [ ]表示后面要跟一个空格(可能还需要别的参数才能生效)
//wearversion
//wearlog
//wearvoiceinputenable
//wearvoiceinputdisable
//weargoogleapi
//assert
//pushassert
//uplog
//upcrash
//switchnotificationstatus
@wong2
wong2 / main.py
Last active August 29, 2015 14:24
遍历友宝免费冰红茶兑换码
#-*-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'
@wong2
wong2 / .vimrc
Created September 18, 2015 08:41
" 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 / jump.js
Created October 19, 2015 09:25
自动播放东方时尚驾考视频
// 在 http://dfss.anjia365.com/jpv2/web/personPlan!player.do 页面,console里输入:
setInterval(function() {
if ($('#player').css('display') == 'none') {
getExamById(examArray.slice(-2)[0]);
examCorrectFlag = true;
$('#nextPlayButton').click();
} else {
showNext();
$('.aui_buttons button').click();
@wong2
wong2 / example.py
Created October 23, 2015 07:15
very simple flask-like web framework, taken from http://lucumr.pocoo.org/2010/6/14/opening-the-flask/
from flask import Flask
app = Flask()
@app.route('/')
def index(request):
return 'Hello World'
if __name__ == '__main__':
app.run()