Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View legumbre's full-sized avatar

Leonardo Etcheverry legumbre

  • GlamST / Ulta
  • Montevideo, Uruguay
View GitHub Profile
(message "testing gist.el")
(message "testing gist.el again")
@legumbre
legumbre / .fetchmailrc
Created June 3, 2011 05:40
my fetchmailrc
set daemon 310
poll pop.gmail.com with proto POP3
user 'user@domain' there with password 'XXXXXXX' is leo here options keep nofetchall ssl sslcertck sslcertpath '/home/leo/.certs/'
mda "/usr/bin/procmail -d %T"
@legumbre
legumbre / *scratch*
Created July 28, 2011 02:11
Pipes and exit status
# forwarding exit status
(exit 127) | echo foo; (exit ${PIPESTATUS[0]}); echo $?
# set mac volume
sudo osascript -e "set Volume 10"
@legumbre
legumbre / gist:1140438
Created August 11, 2011 18:57
simplifying units with emacs calc
;; simplifying units with calc, ie 1.23e-10 s -> 123 ps
'1.23e-10s RET ;; algebraic input
s u ;; calc-simplify-units
@legumbre
legumbre / gist:1140686
Created August 11, 2011 20:34
old calc-eval usage example
;; 1) te bajas una lista de 15 primos impares de aca
;; http://www.research.att.com/~njas/sequences/table?a=65091&fmt=4
;; 2) abris el emacs, (que de todas maneras deberias tenerlo abierto) y pones
(setq list-of-odd-primes '( 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277))
(setq numerito
(let ((first-fifteen (subseq (coerce list-of-odd-primes 'vector) 0 15)))
(reduce 'math-mul first-fifteen)))
@legumbre
legumbre / gist:1148156
Created August 15, 2011 23:40
longest common suffix of two strings
;; awful hack, get the common suffix from two strings using regexp-quote
(let* ((a "foo/bar")
(b "baz/bar")
(ro (regexp-opt (list a b))))
(string-match "\\\\)\\(.*?\\)\\\\)$" ro)
(match-string 1 ro))
;; "/bar"
;; what trickery be this?!
@legumbre
legumbre / *scratch*
Created August 22, 2011 21:26
usb blaster setup CentOS 5
# USB Blaster setup for Centos5
# create /etc/udev/rules.d/51-usbblaster.rules
BUS=="usb", SYSFS{idVendor}=="09fb", SYSFS{idProduct}=="6001",MODE="0666", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf /proc/bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", RUN+="/bin/chmod 0666 %c"
touch ~/.jtag.conf
;; read a key sequence and echo it in kbd-friendly format
(message (edmacro-format-keys (read-key-sequence "key: ") nil))