Skip to content

Instantly share code, notes, and snippets.

@guileen
guileen / tcpdemo.go
Last active August 29, 2015 14:13
TCP服务端demo
package main
import (
"bufio"
"fmt"
"io"
"net"
)
type Client struct {
@guileen
guileen / chat.go
Last active August 29, 2015 14:13
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
@guileen
guileen / another-stage.js
Created September 14, 2014 16:55
Another stage js from some guy.
/**
* 全局变量
*/
var AG_debug = false;
var AG_time = 0;
var AG_startTime = 0;
var AG_running = false;
var AG_stages = [];
var AG_bufCanvas = null;
var AG_bufCtx = null;
;(function() {
/*
* Author: Gui Lin
* guileen AT gmail DOT com
*/
function $ (selector, el) {
return (el||document).querySelector(selector);
}
function $$ (selector, el) {
//// https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java
package com.fasterxml.jackson.databind.util;
import java.util.*;
import java.text.ParsePosition;
import java.text.ParseException;
/**
* Utilities methods for manipulating dates in iso8601 format. This is much much faster and GC friendly than
@guileen
guileen / gist:bdb610291025e9f64db3
Created August 22, 2014 08:15
佛祖保佑.txt
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
___/`---'\___
.' \\| |-- '.
/ \\||| : |||-- \
/ _||||| -:- |||||- \
| | \\\ - --/ | |
@guileen
guileen / android_monitor_uninstall.cpp
Last active August 29, 2015 14:05
http://www.cnblogs.com/zealotrouge/p/3159772.html 思路是今天想到了一个Android自API1就有的一个类FileObserver,这个类用于监听某个文件的变化状态,如果是目录,这个类还可以监听其子目录及子目录文件的变化状态,通过阅读FileObserver源码,发现其实现利用了Linux内核中一个重要的机制inotify,它是一个内核用于通知用户空间程序文件系统变化的机制
/* 头文件begin */
#include "main_activity_UninstalledObserverActivity.h"
/* 头文件end */
#ifdef __cplusplus
extern "C" {
#endif
/* 内全局变量begin */
static char c_TAG[] = "UninstalledObserverActivity.init";
@guileen
guileen / http-proxy-log
Last active August 29, 2015 14:01
http proxy for log
var http = require('http');
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({});
var cclog = require('cclog');
var fs = require('fs');
var zlib = require('zlib');
var i = 1;
http.createServer(function(req, res) {
// req.setEncoding('utf-8');
@guileen
guileen / layout.jade
Created May 3, 2014 10:28
bootstrap blog layout
!!! 5
html(lang='en')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(name='viewport', content='width=device-width, initial-scale=1')
meta(name='description', content='')
meta(name='author', content='')
link(rel='shortcut icon', href='../../assets/ico/favicon.ico')
title Blog Template for Bootstrap
@guileen
guileen / addkey
Last active July 25, 2016 21:44
git shell commands
#!/bin/sh
# If the user is not root
if [ "$USERNAME" != "root" ]
then
# Dislpay a notice and stop
echo "Sorry, only root can use this command."
exit 1