Skip to content

Instantly share code, notes, and snippets.

@gnosis23
gnosis23 / .gdbinit
Created September 30, 2014 04:16
gdbinit sample
file ./backtrace
set disassembly-flavor att
break main
commands
echo +++++This is some text\n
end
run
@gnosis23
gnosis23 / dependency.mk
Last active August 29, 2015 14:11
makefile examples
CFLAGS = -g -Wall -D_DEBUG_ -D_GNU_SOURCE $(ARCH) -Ilib/ -Isrc/
LIBS= $(SOCK) -lm -lpthread
PFLAGS= -follow-child-processes=yes -cache-dir=/tmp/${USER}
PURIFY= purify ${PFLAGS}
# Add any header files you've added here
sr_HDRS = lib/sha1.h lib/sr_dumper.h lib/sr_if.h lib/sr_rt.h lib/sr_utils.h \
lib/vnscommand.h src/sr_arpcache.h src/sr_protocol.h src/sr_router.h
@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]
@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 / 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 / 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 / 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 / cmd.md
Last active October 24, 2015 02:02
从实践中学习一些命令
@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 / 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 ()