Skip to content

Instantly share code, notes, and snippets.

View erickguan's full-sized avatar

Erick Guan erickguan

View GitHub Profile
@erickguan
erickguan / fcitx.json
Last active December 11, 2015 04:28
fcitx
[
{
"name": "Sunpinyin",
"locale": "zh",
"version": "0.3.4",
"license": "LGPL",
"website": "http://code.google.com/p/sunpinyin"
},
{
"name": "foobar",
#include <stdio.h>
int main(void)
{
int h, m, s;
int t_h, t_m, t_s;
int i, n;
while (scanf("%d", &n) != EOF)
for (i = 0; i < n; ++i) {
scanf("%d%d%d%d%d%d",
@erickguan
erickguan / cim.py
Created January 28, 2013 10:52
cim
import urllib.request
import urllib.parse
import http.cookiejar
cookiejar = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(
urllib.request.HTTPCookieProcessor(cookiejar))
dhu_url = "http://jw.dhu.edu.cn/dhu/login_zh.jsp"
login_data = urllib.parse.urlencode({'userName': '', 'userPwd': ''})
login_data = login_data.encode('utf-8')
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> a{1, 2, 3, 4, 5, 6};
do {
std::cout << a[0] << a[1] << a[2] << a[3] << a[4] << a[5] << std::endl;
@erickguan
erickguan / uva_681.cpp
Last active August 29, 2015 14:01
UVa 681
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
using namespace std;
const double eps = 1e-8;
int cmp(double x) {
@erickguan
erickguan / UVA_10002.cpp
Last active August 29, 2015 14:01
UVa 10002
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
using namespace std;
const double eps = 1e-8;
int cmp(double x) {
@erickguan
erickguan / UVA_10180.cpp
Last active August 29, 2015 14:01
UVa 10180
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
static const double eps = 1e-8;
int cmp(double x)
@erickguan
erickguan / a.sql
Last active August 29, 2015 14:06
SQL
/* Easy Drop */
DROP TABLE selected_courses;
DROP TABLE students;
DROP TABLE courses;
DROP TABLE teachers;
/* 1: Create table structure */
CREATE TABLE teachers (id INTEGER NOT NULL, name CHAR(8) NOT NULL, title CHAR(10), PRIMARY KEY(id));
CREATE TABLE courses (id INTEGER NOT NULL, name CHAR(10) NOT NULL, teacher_id INTEGER, PRIMARY KEY(id));
CREATE TABLE students (id INTEGER NOT NULL, name CHAR(8) NOT NULL, age SMALLINT, sex CHAR(1), PRIMARY KEY(id));
# encoding: utf-8
#
# Author: Erick Guan <fantasticfears@gmail.com>
#
# This script import the data from latest Discuz! X
# Should work among Discuz! X3.x
# This script is tested only on Simplified Chinese Discuz! X instances
# If you want to import data other than Simplified Chinese, email me.
require File.expand_path(File.dirname(__FILE__) + "/base.rb")
@erickguan
erickguan / Gemfile
Created May 10, 2015 11:39
common gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'sprockets', '~> 3.0.3'
gem 'sprockets-es6'
gem 'pundit'
gem 'refile'