Skip to content

Instantly share code, notes, and snippets.

View chareice's full-sized avatar

ChengLei Shao chareice

  • GuangZhou China
View GitHub Profile
@chareice
chareice / base.py
Last active December 27, 2015 18:29
initial data for Flask model via fixture file.
from extensions import db
class Base(object):
def save(self):
db.session.add(self)
db.session.commit()
@chareice
chareice / appunittest.py
Created November 15, 2013 12:49
Flask单元测试
import unittest
from flask.ext.testing import TestCase
from testconfig import TestConfig
from admin import app
from admin.urls import url_routes
from init_app import create_app
from extensions import db
def assertCreate(models):
@chareice
chareice / test.py
Created November 16, 2013 07:58
test
# -*- coding: utf-8 -*-
__all__ = ["DB", ]
import contextlib
import psycopg2
from psycopg2 import extensions
from gevent.socket import wait_read, wait_write
@chareice
chareice / Rakefile
Created February 8, 2014 06:38
Hide Status Bar in rubymotion
app.info_plist['UIStatusBarStyle'] = 'UIStatusBarStyleBlackTranslucent'
app.info_plist["UIViewControllerBasedStatusBarAppearance"] = false
#!/bin/bash
echo Building Google Protobuf for Mac OS X / iOS.
echo Use 'tail -f build.log' to monitor progress.
(
PREFIX=`pwd`/protobuf
mkdir ${PREFIX}
mkdir ${PREFIX}/platform
@chareice
chareice / temp.c
Created August 4, 2014 11:22
Arduino温度湿度 光照 声音数据采集
#include <Bridge.h>
#include <FileIO.h>
#include "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT11
#define SOUND A1
#define LIGHT A2
DHT dht(DHTPIN, DHTTYPE);
String getTempAndHum();
#include <OpenGL/gl3.h>
#include <GLUT/glut.h>
void init(){
glClearColor(1.0, 1.0, 1.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0, 200, 0, 150);
}
void lineSegment(){
@chareice
chareice / .vimrc
Created October 30, 2014 05:45
vimrc
set nocompatible " be iMproved
filetype off " required!
set nobackup
set nowritebackup
" Close bell
set vb t_vb=
set mouse=a
@chareice
chareice / gfwlist.js
Created December 17, 2014 13:31
gfwlist.js
// Generated by gfwlist2pac
// https://github.com/clowwindy/gfwlist2pac
var domains = {
"vimcasts.org" : 1,
"vim.org" : 1,
"wenincode.com" : 1,
"amazonaws.com" : 1,
"codeception.com" : 1,
"opensuse.org" : 1,
@chareice
chareice / .vimrc
Created December 17, 2014 13:31
vimrc
execute pathogen#infect()
filetype plugin indent on
syntax on
set nu
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab