Skip to content

Instantly share code, notes, and snippets.

View srid's full-sized avatar

Sridhar Ratnakumar srid

View GitHub Profile
@pinge
pinge / ubuntu_14.04_macbook_pro_retina_15_inch_mid_2014.md
Last active March 10, 2021 03:05
How to install Ubuntu 14.04.1 LTS on a MacBook Pro Retina 15" Mid 2014 (11,3)
@srid
srid / subcommand.go
Created October 24, 2012 22:52
golang simple subcommand parser
// A simple sub command parser based on the flag package
package subcommand
import (
"flag"
"fmt"
"os"
)
type subCommand interface {
@srid
srid / gist:2151665
Created March 21, 2012 19:23
building doozerd and doozer
# install go weekly to ~/go
cd
hg clone https://go.googlecode.com/hg/ go
hg up weekly
cd src && ./make.bash
export PATH=~/go/bin:$PATH
export GOROOT=~/go
# doozer client
cd $GOROOT/src/pkg/github.com/ha/
anonymous
anonymous / db.go
Created January 24, 2012 17:39
Go SDK for Dropbox
package dropbox
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
@pdxmph
pdxmph / save_chrome_url.rb
Created November 6, 2011 03:47
Add a URL from Chrome to Safari's reading list
#!/usr/bin/env ruby -wKU
require "rubygems"
require "appscript"
include Appscript
chrome = app("Google Chrome")
safari = app("Safari")
chrome_tab = chrome.windows[1].active_tab
;; chouser's solution to Sequs Horribilis
;; https://4clojure.com/problem/112
(fn [limit xs]
(second ((fn f [[limit] xs]
(if (coll? xs)
(let [rs (take-while #(<= 0 (first %))
(reductions f [limit] xs))]
[(first (last rs)) (map second (rest rs))])
[(- limit xs) xs]))
@Folcon
Folcon / clipboard-utils.clj
Created August 24, 2011 11:50
Just a quick clipboard slip/slurp I put together because I didn't find anything similar, don't know if it's useful for anyone but found it invaluable when getting large strings being returned from the repl and sticking the result in an editor for more car
(defn get-clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp-clipboard []
(try
(.getTransferData (.getContents (get-clipboard) nil) (java.awt.datatransfer.DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))
(defn spit-clipboard [text]
(.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) nil))
@srid
srid / pypm-six.diff
Created November 23, 2010 05:26
six 1.0 changes
Index: src/pypm/builder/mason.py
===================================================================
--- src/pypm/builder/mason.py (revision 59138)
+++ src/pypm/builder/mason.py (working copy)
@@ -18,7 +18,7 @@
from contextlib import contextmanager
from datetime import datetime
-import six.strdata
+import six
@srid
srid / README.txt
Created October 15, 2010 16:41
Patches used in ActivePython 2.7 for building on AIX 5.1.
Contact sridharr@activestate.com for more info.