Skip to content

Instantly share code, notes, and snippets.

@lsgrep
lsgrep / bootstrap.js
Created February 15, 2015 13:31
casperjs fix
//libexec/bin/bootstrap.js
system = require('system');
var argsdeprecated = system.args;
argsdeprecated.shift();
phantom.args = argsdeprecated;
@lsgrep
lsgrep / *scratch*.el
Last active August 29, 2015 14:16
Cleanup IPTABLES
#!/bin/sh
echo "Stopping firewall and allowing everyone..."
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
@lsgrep
lsgrep / custom.el
Created February 27, 2015 18:50
Emacs Key bings for "reloaded"
(defun nrepl-refresh ()
(interactive)
(call-interactively 'cider-switch-to-relevant-repl-buffer)
(goto-char (point-max))
(insert "(clojure.tools.namespace.repl/refresh)")
(cider-repl-return))
(defun nrepl-reset ()
(interactive)
(call-interactively 'cider-switch-to-relevant-repl-buffer)
@lsgrep
lsgrep / music.clj
Created February 28, 2015 13:12
Getting mp3 links from music site
(def song-url "http://www.mzhiphop.com/song-17803-Usher---Paradise")
(def song-static "http://www.sharebeast.com/mp3embed-")
(defn get-download-url [url]
(str song-static
(second
(str/split (second
(str/split
(get-in (nth
(html/select
(html/html-resource
@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...
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 / 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
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
-- mysql super user
CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';
(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