Skip to content

Instantly share code, notes, and snippets.

View danielef's full-sized avatar

Daniel Estévez danielef

  • Ontario, Canada
  • 09:59 (UTC -04:00)
  • X @danielef
View GitHub Profile
@danielef
danielef / fyf.clj
Created July 30, 2016 18:50
Factorial & Fibonnaci en Clojure
;; Factorial Recursivo
;; http://stackoverflow.com/questions/1662336/clojure-simple-factorial-causes-stack-overflow
(defn !-recursive [x]
(if (= x 1) 1N
(* x (!-recursive (dec x)))))
;; Factorial Iterativo
;; https://mitpress.mit.edu/sicp/full-text/sicp/book/node15.html
(defn !-iterative
([x] (!-iterative 1N 1 x))
@danielef
danielef / run-elasticsearch-in-docker.sh
Created September 2, 2016 16:43
Run ElasticSearch in Docker
sudo sysctl -q -w vm.max_map_count=262144
docker run -p 9200:9200 --security-opt seccomp=unconfined -i -t danielef/elasticsearch:5.0.0-alpha5
@danielef
danielef / get-all-indexes.bash
Last active January 12, 2018 15:52
#ElasticSearch get all indexes
curl http://localhost:9200/_cat/indices?v
@danielef
danielef / delete-all-docker-containers.bash
Created September 5, 2016 17:32
Docker delete all containers
for i in $( docker ps -a | sed -n '1!p' | awk '{print$1}' ); do docker rm $i; done
@danielef
danielef / classloader-repl.cl
Created September 14, 2016 01:02
Add a jar dependency to classloader
(-> (-> (Thread/currentThread) (.getContextClassLoader)) (.addURL (java.net.URL. "file:///path/to/jboss-cli-client.jar")))
@danielef
danielef / xstats-by-metric.bash
Created September 29, 2016 05:37
Elasticsearch extended stats by field
curl -XGET 'http://localhost:9200/logstash-2016.09.28/_search?pretty=true' -d ' {
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"term": {"service.raw": "jmx.Memory.HeapMemoryUsage.used"}}
]
}
}
@danielef
danielef / run.conf
Created October 15, 2016 00:00
JMX SOAP-Version 5.3.0.GA (without authentication)
## -*- shell-script -*- ######################################################
## ##
## JBoss Bootstrap Script Configuration ##
## ##
##############################################################################
### $Id: run.conf 91533 2009-07-22 01:20:05Z gbadner $
#
# This shell script is sourced by run.sh to initialize the environment
@danielef
danielef / jmx.level
Created October 15, 2016 00:07
JMX SOAP-Version 5.3.0.GA (with authentication)
guest readonly
admin readwrite
@danielef
danielef / rename.sh
Created October 17, 2016 15:33
Elasticsearch rename index
curl -X POST http://localhost:9200/_reindex -d '{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter"
}
}'
curl -X DELETE http://localhost:9200/twitter
@danielef
danielef / netcheck-instance.log
Created November 1, 2016 04:04
AWK gets a log with specified line starts and write a CSV
;; Query time: 13 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Oct 27 14:05:26 2016
;; MSG SIZE rcvd: 53
size inuse free pin virtual mmode
memory 4030464 3606573 423891 821507 2071729 Ded
pg space 4325376 28186