View ripgreprc
--colors=line:fg:yellow
--colors=line:style:bold
--colors=path:fg:green
--colors=path:style:bold
--colors=match:fg:black
--colors=match:bg:yellow
--colors=match:style:nobold
--smart-case
View show_cron.sh
#!/bin/bash
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# 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++'
View cmake_clean.sh
# 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])
(:gen-class))
(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 (java.io.File. next-level))
(recur (rest levels) next-level)))))
View consumer.clj
(ns oceanus.anduin.clj.consumer
(:gen-class)
(:import [kafka.consumer ConsumerConfig Consumer KafkaStream]
[kafka.javaapi.consumer ConsumerConnector]
[java.util Properties]))
(defn make-props
"convert a clojure map into a Properties object."
[m]
(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)
end.
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
-module(tuple_util).
-export([is_element_of_tuple/2]).
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)).