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
# show git branch in prompt
# got it from https://gist.github.com/790086
parse_git_branch() {
ref=$(git symbolic-ref -q HEAD 2> /dev/null) || return
printf "${1:-(%s)}" "${ref#refs/heads/}"
}
parse_svn_revision() {
local DIRTY REV=$(svn info 2>/dev/null | grep Revision | sed -e 's/Revision: //')
;; defadvice sample for dropdive
(defadvice ask-user-about-supersession-threat (around ask-user-supersession-with-diff activate)
"Diff the buffer with the backing (modified) file"
(diff-buffer-with-file)
ad-do-it)
(query-replace-regexp "\"description\": \\[
.*
.*
.*
.*\\]" "REPLACED!" nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end))) ;; C-x C-e here
"description": [
foo,
bar,
baz,
"description": [
foo,
bar,
baz,
ban ]
"description": [
foo2,
bar2,
baz2,
gist.el test test test
@legumbre
legumbre / verify.sh
Created November 6, 2011 03:28
GPG verify signature (firefox)
# verifying firefox signature on live distro
user@debian:~/Downloads$ gpg --verify firefox-7.0.1.tar.bz2.asc firefox-7.0.1.tar.bz2
gpg: Signature made Fri 30 Sep 2011 06:39:02 PM UTC using DSA key ID C52175E2
gpg: Can't check signature: public key not found
user@debian:~/Downloads$ gpg --search-keys C52175E2
gpg: searching for "C52175E2" from hkp server keys.gnupg.net
(1) Mozilla Software Releases <[email protected]>
1024 bit DSA key 1EBCAB3A, created: 2011-07-22
2: [ [ 3, 3, 3 ]
[ 1, 2, 3 ]
[ 4, a, c ] ]
;; V D
1: 6 c + 36 + 3 a - 24 - 9 a - 3 c
;; X looks
(setq initial-frame-alist
'((menu-bar-lines . 0)
(tool-bar-lines . 0)
(horizontal-scroll-bars . nil)
(vertical-scroll-bars . nil)
(foreground-color . "bisque2")
(background-color . "dark slate gray")
(cursor-color . "orange")
(mouse-color . "dark slate gray")
(require 'url)
(let ((url-request-method "POST")
(url-request-extra-headers '(("Content-Type" . "application/x-www-form-urlencoded")))
(url-request-data "field1=Hello&field2=from&field3=Emacs"))
(with-current-buffer (url-retrieve-synchronously "http://example.net/foo/bar") (buffer-string))) ;; C-x C-e here to POST
function Ring:disconnect_ring(other_ring)
local mapEntry= self.other_rings[other_ring]
local tangent= mapEntry.tangent
klog.debug("DISCONNECTING %s(%s) -> %s(%s) ", self.id, tostring(self), other_ring.id, tostring(other_ring), tostring(mapEntry.tangent))
if not mapEntry then
log.warning("Trying to disconnect %d from %d but no previous connection existed", self.id, other_ring.id)
end
self.other_rings[other_ring]= nil -- other_ring is not mapped anymore