# System-wide crontab file and cron job directory. Change these for your system.
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
# Given a stream of crontab lines, exclude non-cron job lines, replace
View my_configs.vim
set pastetoggle=<F3>
set nu
"""""""""""""""""c/cpp/cu settings""""""""""""""""""""""""""""""""""
" check cpp code applying c++11 standard
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libc++'
" on some system:
" let g:syntastic_cpp_compiler = 'g++'
# Find and then delete all files under current directory (.) that:
# 1. contains cmake (case-&insensitive) in it's path (wholename)
# 2. name is not CMakeLists.txt
find . -iwholename '*cmake*' -not -name CMakeLists.txt -delete
View reliable_word_count.clj
(ns storm.starter.clj.word-count2
(:import [backtype.storm StormSubmitter LocalCluster])
(:use [backtype.storm clojure config log])
(def id-count (atom 0)) ;; tuple counter for debugging -- something to make ids out of
(defspout sentence-spout ["sentence"]
[conf context collector]
(let [sentences ["a little brown dog"
View gist:6862398
(defn mkdirs [absolute-path]
(loop [levels (clojure.string/split absolute-path #"/")
current ""]
(when (not (empty? levels))
(let [next-level (str current (first levels) "/")]
(.mkdir ( next-level))
(recur (rest levels) next-level)))))
View consumer.clj
(ns oceanus.anduin.clj.consumer
(:import [kafka.consumer ConsumerConfig Consumer KafkaStream]
[kafka.javaapi.consumer ConsumerConnector]
[java.util Properties]))
(defn make-props
"convert a clojure map into a Properties object."
(let [props (Properties.)]
View read_lines.erl
for_each_line_in_file(Name, Proc, Mode, Accum0) ->
{ok, Device} = file:open(Name, Mode),
for_each_line(Device, Proc, Accum0).
for_each_line(Device, Proc, Accum) ->
case io:get_line(Device, "") of
eof -> file:close(Device), Accum;
Line -> NewAccum = Proc(Line, Accum),
for_each_line(Device, Proc, NewAccum)
View concat_binary.erl
% concat, binary
B1= <<1,2>>.
B2= <<3,4>>.
B3= <<B1/binary, B2/binary>>.
% <<1,2,3,4>>
View is_element_of_tuple.erl
is_element_of_tuple(Tuple, Element) ->
lists:member(Element, tuple_to_list(Tuple)).
% or like this:
is_element_of_tuple(E, Tuple) ->
is_element_of_tuple(E, Tuple, 1, tuple_size(Tuple)).
View method_hook.rb
class Base
def self.method_added(name)
if /hook/.match(name.to_s) or method_defined?("#{name}_without_hook")
hook = "def #{name}_hook\n p 'Method #{name} has been called'\n #{name}_without_hook\nend"
a1 = "alias #{name}_without_hook #{name}"