Skip to content

Instantly share code, notes, and snippets.

(fn lazy-search
"elegant as fuck, http://www.4clojure.com/problem/108"
[& x]
(let [[[b & e] & c] (sort-by first x)]
(if (apply = (map first x))
b
(apply lazy-search (conj c e)))))
(Thread/setDefaultUncaughtExceptionHandler
(reify Thread$UncaughtExceptionHandler
(uncaughtException [_ thread ex]
(track-error :thread-exception ex "Uncaught exception on" (.getName thread)))))
StrictHostKeyChecking no
HashKnownHosts yes
TCPKeepAlive yes
ServerAliveInterval 20
GSSAPIAuthentication no
GSSAPIDelegateCredentials no
Host my
# edit file: /etc/ssh/sshd_config
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
PermitRootLogin no
(import com.google.gson.stream.JsonReader)
(import com.google.gson.Gson)
(def data "[{\"id\":2,\"name\":\"Thing1\"},{\"id\":3,\"name\":\"Thing2\"},{\"id\":4,\"name\":\"Thing3\"}]")
(def gson (Gson.))
(defrecord example [id name])
(defn to-record [java-map]
(map->example (into {} (map
(juxt
-- mysql super user
CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';
location / {
proxy_redirect off;
proxy_pass http://www.google.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding ""; #2
proxy_set_header User-Agent "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 (this is for 3.2 beta 3)"; #3
proxy_set_header Accept-Language "en-US"; #4
proxy_set_header Cookie "PREF=ID=xxxxxx:U=yyyyy:FF=0:LD=zh-CN:NW=1:CR=2:TM=zzzz:LM=mmmmm:GM=1:SG=1:S=-nnnnn"; #5
@lsgrep
lsgrep / gist:58dfc0adfb57e66f94ed
Created March 14, 2015 03:24
Installing Marvel Plugin for ElasticSearch
#install elasticsearch marvel plugin
sudo docker run -v $HOME/data:/data dockerfile/elasticsearch /elasticsearch/bin/plugin -i elasticsearch/marvel/latest
the ulimit command by default changes the HARD limits, which you (a user) can lower, but cannot raise.
Use the -S option to change the SOFT limit, which can range from 0-{HARD}.
I have actually aliased 'ulimit' to 'ulimit -S', so it defaults to the soft limits all the time.
alias ulimit='ulimit -S'
As for your issue, you're missing a column in your entries in limits.conf
There should be FOUR colums, the first is missing in your example.
@lsgrep
lsgrep / *temp*.clj
Created March 1, 2015 09:00
Clojure Gem
;;clojure tip . Clojure is awesome and all,but
;;0. you need to have a working and comfortable workflow.
;; I use emacs and I quite like "reloaded" workflow
;;1. wrap stateful services as components
;; when you start adding more stuff to you project,
;; you have to control code complexity with abstractions.
;; or you are piling up soon to be dead code...