Skip to content

Instantly share code, notes, and snippets.

@DuqueDeTuring
DuqueDeTuring / gist:1463422
Created December 11, 2011 23:17
Mapear en Terminal Option derecho a Escape, usando KeyRemap4MacBook
<item>
<name>Cambiar Option_R a Escape para usar en Terminal</name>
<identifier>private.cambiar_optionr_a_escape_en_terminal</identifier>
<only>TERMINAL</only>
<autogen>--KeyToKey-- KeyCode::OPTION_R, KeyCode::ESCAPE</autogen>
</item>
@DuqueDeTuring
DuqueDeTuring / clojure-loc2.clj
Created December 28, 2011 19:50
Reescritura del ejemplo de for clojure-loc, del libro "Programming Clojure" usando una operación sobre listas distinta
;Reescritura del ejemplo de for clojure-loc, del libro "Programming Clojure" usando una operación sobre listas distinta
;Rewrite of "Programming Clojure"'s clojure-loc for example with a different list comprehension
(use '[clojure.java.io :only (reader)])
(defn non-blank? [line] (if (re-find #"\S" line) true false))
(defn clojure-source? [file] (.endsWith (.toString file) ".clj"))
(defn clojure-loc2 [base-file]
@DuqueDeTuring
DuqueDeTuring / gist:3154252
Created July 21, 2012 02:15
Agrega a un repositorio git los archivos modificados en los últimos 2 minutos (excluyendo el directorio del repositorio)
find . -name '.git*' -type d -prune -o -newerct "2 minute ago" -type f -print -exec git add '{}' \;
@DuqueDeTuring
DuqueDeTuring / sha1-hash.clj
Created September 20, 2012 22:08 — forked from prasincs/sha1-hash.clj
clojure sha1 hash
(defn get-hash [type data]
(.digest (java.security.MessageDigest/getInstance type) (.getBytes data) ))
(defn sha1-hash [data]
(get-hash "sha1" data))
(defn get-hash-str [data-bytes]
(apply str
(map
#(.substring
#!/bin/bash
# This is free and unencumbered shell script released into the public domain.
#
####################### Begin Customization Section #############################
#
# Name of the recipe to fetch. You can run:
# ebook-convert --list-recipes
# to look for the correct name. Do not forget the .recipe suffix
RECIPE="La Jornada (Mexico).recipe"
:dependencies [ [google/oauth-client "1.16.0"]
[google/http-client "1.16.0"]
[google/oauth-client-java6 "1.16.0"]
[google/oauth-client-jetty "1.16.0"]
[gdata/gdata-base "1.0"]
[gdata/gdata-core "1.0"]
[gdata/docs "3.0"]
[gdata/docs-meta "3.0"]
[gdata/gdata-client "1.0"]
[gdata/gdata-client-meta "1.0"]
@DuqueDeTuring
DuqueDeTuring / crema de espinacas
Last active August 29, 2015 13:57
Crema de espinacas
Crema de espinacas
1/4 pieza de cebolla blanca
4 cucharadas de aceite de oliva
1/4 cucharita de pimienta negra molida
1 diente de ajo
2 manojos de espinaca
1 cucharada de harina de trigo
1/4 manojo de cilantro
1 taza de leche de vaca
;; clojure.data.xml/
(let [tags (element :foo {:foo-attr "foo value"}
(element :bar {:bar-attr "bar value"}
(element :baz {} "The baz value")))]
(with-open [out-file (java.io.FileWriter. "/tmp/foo.xml")]
(emit tags out-file)))
;; source: https://github.com/clojure/data.xml
@DuqueDeTuring
DuqueDeTuring / gist:43a49216dd11190d465f
Created December 9, 2014 16:19
Forwarding ports in Chef kitchen file
driver:
name: vagrant
network:
- ["forwarded_port", {guest: 5432, host: 5432}]
@DuqueDeTuring
DuqueDeTuring / gist:d29adda940d92d4953ea
Created December 22, 2014 15:06
Auto restart ssh tunnel
autossh -f -N -L8888:127.0.0.1:3306 [email protected]
(http://serverfault.com/a/285610)