Skip to content

Instantly share code, notes, and snippets.

View fanzeyi's full-sized avatar

Zeyi (Rice) Fan fanzeyi

View GitHub Profile
@fanzeyi
fanzeyi / main.go
Created July 5, 2016 08:46
A simple TCP echo server for Chrome's native messaging
package main
import (
"fmt"
"os"
"net"
"bufio"
"encoding/binary"
)
@fanzeyi
fanzeyi / code-check-exporter.user.js
Last active August 29, 2015 14:14
Code Check Exporter
// ==UserScript==
// @name Code Check Exporter
// @namespace https://zr.is/
// @version 0.5
// @description Export all files in code checker. (SJSU)
// @author Zeyi Fan (Zeray Rice)
// @match http://cs20.cs.sjsu.edu:8080/codecheck/*
// @grant none
// @require https://raw.githubusercontent.com/Stuk/jszip/v2.4.0/dist/jszip.min.js
// @updateURL https://gist.github.com/fanzeyi/c46ab3dc5319ac24b7f0/raw/code-check-exporter.user.js
@fanzeyi
fanzeyi / chinese_district.py
Created January 10, 2015 18:41
integrate GB2260 with SQLAlchemy
# -*- coding: utf-8 -*-
import gb2260
import sqlalchemy.types as types
class ChineseDistrict(types.TypeDecorator):
impl = types.Integer
def process_bind_param(self, value, dialect):
[Adblock Plus 2.0]
! Version: 20141221
! Title: DoubanList
! Expires: 1 day (update frequency)
! Homepage: https://gist.github.com/fanzeyi/b69bff4c45f3dc9d44d0
!
douban.com##.lnk-doubanapp
douban.com##.get_douban_app
movie.douban.com###app-discuss
@fanzeyi
fanzeyi / gist:18fc24a495c72a68e4b0
Last active August 29, 2015 14:09
Integrate SQLAlchemy with Enum34
class Enum34(types.TypeDecorator):
impl = types.Integer
def __init__(self, enum_class, *args, **kwargs):
super(Enum34, self).__init__(*args, **kwargs)
self._enum_class = enum_class
def process_bind_param(self, value, dialect):
if value not in self._enum_class:
raise ValueError("Not a valid enum value")
#!/bin/sh
if [ $(git diff --cached | grep "debugger|console\.log" -E | grep -E "^\+" | wc -l) -gt 0 ]; then
echo "[Pre-commit check] Detected debug code in commit. Remove it!"
exit 1
fi
exit 0
@fanzeyi
fanzeyi / 10.9.patch
Last active January 1, 2016 22:29
SDL 1.2.15 Patch for 10.9
--- ./src/video/quartz/SDL_QuartzVideo.h 2014-01-02 02:36:48.000000000 +0800
+++ ./src/video/quartz/SDL_QuartzVideo.h 2014-01-02 02:36:50.000000000 +0800
@@ -91,7 +91,9 @@
CGDirectDisplayID display; /* 0 == main display (only support single display) */
const void *mode; /* current mode of the display */
const void *save_mode; /* original mode of the display */
+#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
CGDirectPaletteRef palette; /* palette of an 8-bit display */
+#endif
NSOpenGLContext *gl_context; /* OpenGL rendering context */
@fanzeyi
fanzeyi / app.py
Created November 15, 2013 19:17
Simple stream file proxy with Flask and Requests
# -*- coding: utf-8 -*-
from flask import Flask
from flask import Response
from flask import stream_with_context
import requests
app = Flask(__name__)
@fanzeyi
fanzeyi / v2ex_api.md
Last active November 27, 2022 13:42
V2EX API
@fanzeyi
fanzeyi / .vimrc
Last active December 21, 2015 15:19
" Zeray Rice's New Vimrc
" Created: Augest 24, 2013
" ===============
" Vundle
" ===============
set nocompatible
filetype off