Skip to content

Instantly share code, notes, and snippets.

@gnosis23
gnosis23 / gulpfile.js
Last active February 26, 2017 06:51
gulp.js sample
/* File: gulpfile.js */
var gulp = require('gulp'),
less = require('gulp-less'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename');
var minifycss = require('gulp-minify-css');
var watchPath = require('gulp-watch-path');
var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
@gnosis23
gnosis23 / lang.l
Created March 19, 2016 05:19
language start pieces
%option noyywrap yylineno
%{
#include "lang.tab.h"
%}
DIGIT ([0-9])
LETTER ([a-zA-Z])
%%
@gnosis23
gnosis23 / gist:986db413730484390eb2
Created March 2, 2016 05:44 — forked from danking/gist:1068185
A very simple example showing how to use Racket's lexing and parsing utilities
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
parser-tools/yacc)
(provide (all-defined-out))
(define-tokens a (NUM VAR))
(define-empty-tokens b (+ - EOF LET IN))
(define-lex-trans number
(syntax-rules ()
@gnosis23
gnosis23 / Model.js
Last active November 26, 2015 09:43
two way binding
/**
* 给html标签加上属性data-bind-xxx
* (datebox用data-bind-datebox-xxx,
* checkbox用data-bind-checkbox-xxx)
* 然后使用 var params = new window.Model('xxx') 就能双向绑定了
* Created by wang.bh on 2015/11/24.
*/
(function () {
function DataBinder(object_id) {
// Use a jQuery object as simple PubSub
@gnosis23
gnosis23 / cmd.md
Last active October 24, 2015 02:02
从实践中学习一些命令
@gnosis23
gnosis23 / ncdc.sh
Created October 24, 2015 01:56 — forked from rehevkor5/ncdc.sh
Download a weather dataset from the National Climatic Data Center (NCDC, http://www .ncdc.noaa.gov/). Prepare it for examples of "Hadoop: The Definitive Guide" book by Tom White. http://www.amazon.com/Hadoop-Definitive-Guide-Tom-White/dp/1449311520 Usage: ./ncdc.sh 1901 1930 # download wheather datasets for period from 1901 to 1930. This version…
#!/usr/bin/env bash
# global parameters
g_tmp_folder="ncdc_tmp";
g_output_folder="ncdc_data";
g_remote_host="ftp.ncdc.noaa.gov";
g_remote_path="pub/data/noaa";
@gnosis23
gnosis23 / sqoop.sh
Created September 3, 2015 11:35
sqoop
sqoop import --connect jdbc:mysql://10.0.0.4/employees \
--table salaries \
--username bohao \
--password-file /user/bohao/pass \
--hive-import \
--hive-drop-import-delims \
--null-string '\\N' \
--null-non-string '\\N'
@gnosis23
gnosis23 / example.java
Last active August 29, 2015 14:24
Redis配置
public class RedisExample {
private StringRedisTemplate redisTemplate;
public void setRedisTemplate(StringRedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
private HashOperations<String, String, Long> hashOps;
public void setHashOps(HashOperations<String, String, Long> hashOps) {
@gnosis23
gnosis23 / makefile.mk
Created February 18, 2015 17:04
gcc options
gcc -m64 -std=c99 -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual \
-Wstrict-prototypes -Wmissing-prototypes
@gnosis23
gnosis23 / bash.sh
Created January 14, 2015 03:01
ctags
# -e support emacs
# --C-kinds=+l local variables
ctags -e --C-kinds=+l -R */*.[ch]