Skip to content

Instantly share code, notes, and snippets.

@vkurup
vkurup / gist:00c660135278f307e5d4
Created May 7, 2014 15:27
show git branch on command line
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\u@\h:\w\$(parse_git_branch) $ "
@vkurup
vkurup / gist:b23cb6c563727d4ed720
Created May 21, 2014 20:32
clojurescript install
vinod@cartman:~/dev/vkcljs $ git clone git://github.com/clojure/clojurescript.git
Cloning into 'clojurescript'...
remote: Reusing existing pack: 15002, done.
remote: Counting objects: 42, done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 15044 (delta 13), reused 2 (delta 0)
Receiving objects: 100% (15044/15044), 3.56 MiB | 1.49 MiB/s, done.
Resolving deltas: 100% (6516/6516), done.
Checking connectivity... done.
vinod@cartman:~/dev/vkcljs $ cd clojurescript/
@vkurup
vkurup / gist:491f95a7c08819009275
Created July 23, 2014 13:47
Possible race condition
@transaction.atomic
def get_pending_messages():
"""Return a list of messages to be sent out and mark them as 'sent' in the db."""
msg_qs = SMSSyncMessage.objects.select_for_update().filter(backend_name=self.name,
date_sent=None)
messages = [dict(message=m.text, to=m.identity)
for m in msg_qs]
if msg_qs:
msg_qs.update(date_sent=now())

Keybase proof

I hereby claim:

  • I am vkurup on github.
  • I am vkurup (https://keybase.io/vkurup) on keybase.
  • I have a public key whose fingerprint is 01AC F6AB EA98 0D16 5777 C37D DA8E 3DB4 6683 2BC1

To claim this, I am signing this object:

; i'm an elisp newbie
(defun vk-copy-ledger-entry-to-bottom ()
"Copy the current transaction to the bottom of the ledger"
(interactive)
(re-search-backward "^[12][90]")
(let ((beg (point)))
(forward-char)
(re-search-forward "^[12][90]")
(beginning-of-line)
@vkurup
vkurup / vk-watch-rebuild.sh
Created June 15, 2010 15:03
Watch a blogofile directory and rebuild if a change is noticed.
#!/bin/bash
BLOGOFILE='/usr/local/bin/blogofile'
BLOGDIR='/home/vinod/web/blogofile'
while LINE=$(inotifywait -rq --timefmt '%F %R' --format '%T %e %f' -e close_write -e move -e delete "$BLOGDIR");
do
cd $BLOGDIR
$BLOGOFILE build
echo "Rebuilt: $LINE"
@vkurup
vkurup / driver.patch
Created September 9, 2011 01:45
Patch to fix RT2860sta driver
diff -urbB old/common/cmm_wpa.c new/common/cmm_wpa.c
--- old/common/cmm_wpa.c 2010-07-08 07:40:24.000000000 -0400
+++ new/common/cmm_wpa.c 2011-08-30 18:27:46.856572005 -0400
@@ -2420,7 +2420,7 @@
UCHAR PrimaryRsnie;
BOOLEAN bMixCipher = FALSE; // indicate the pairwise and group cipher are different
UCHAR p_offset;
- WPA_MIX_PAIR_CIPHER FlexibleCipher = MIX_CIPHER_NOTUSE; // it provide the more flexible cipher combination in WPA-WPA2 and TKIPAES mode
+ WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES;
@vkurup
vkurup / gist:1232648
Created September 21, 2011 16:57
emacs-snapshot on natty
vinod@rails:~$ uname -a
Linux rails 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:18:14 UTC 2011 i686 i686 i386 GNU/Linux
vinod@rails:~$ wajig install emacs-snapshot-nox
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
@vkurup
vkurup / config.log
Created October 9, 2011 12:14
Ledger 3.0 config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ledger configure 3.0.0-20110325, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ configure CPPFLAGS=-isystem /usr/local/include -isystem /usr/include/python2.6 CXXFLAGS=-Wconversion -pthread -g -pipe LDFLAGS=-fpch-deps -g -L/usr/local/lib -L/usr/lib -L/usr/lib/python2.6/config --with-included-gettext --enable-python --enable-pch --enable-debug
## --------- ##
## Platform. ##
@vkurup
vkurup / glue-quote.sh
Created November 23, 2011 20:43
Take formatted commodity output from ledger and feed it to getquote
#!/bin/bash
# Reads from STDIN looking for ledger-formatted commodity symbols. Uses
# getquote (Perl script) to lookup the lastest price for commodity, then
# appends to PRICEDB file.
#
# Usage:
# ledger -n bal ^Assets:Investments | glue-quote.sh
#
# Assumes that you have 'getquote' on your path