Skip to content

Instantly share code, notes, and snippets.

View srid's full-sized avatar
🌤️
a smoothly flowing moment of clear experiencing

Sridhar Ratnakumar srid

🌤️
a smoothly flowing moment of clear experiencing
View GitHub Profile
// read-only registry API server
// TODO:
// * directly read from the .tar file (will break martini.Static)
// * UX friendly error handling
package main
import (
"encoding/json"
@srid
srid / bash_prompt_sh
Last active August 29, 2015 14:01
stackato bash prompt
#!/bin/bash -e
redis_hostport=$(cat /s/etc/kato/redis_uri | cut -d"/" -f3)
redis_host=$(echo $redis_hostport | cut -d: -f1)
redis_port=$(echo $redis_hostport | cut -d: -f2)
redis_cli="redis-cli -h ${redis_host} -p ${redis_port}"
user=$(whoami)
endpoint=$(timeout 0.1 $redis_cli get cluster | json endpoint)
ipaddr=$(timeout 0.1 /sbin/ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}')
roles=$(timeout 0.1 $redis_cli get node | json "[\"${ipaddr}\"]" | json roles | json -ak | paste -sd "," -)
@srid
srid / jekyll-serve.el
Last active August 29, 2015 14:14
Start local jekyll server (edited by Srid) - http://oremacs.com/2015/02/01/blogging-about-blogging/
(defun jekyll-serve ()
(interactive)
(let* ((default-directory
(if (string-match "_posts/$" default-directory)
(directory-parent default-directory)
default-directory))
(buffer (if (get-buffer "*jekyll*")
(switch-to-buffer "*jekyll*")
(ansi-term "/bin/bash" "jekyll")))
(proc (get-buffer-process buffer)))
@srid
srid / laundryCoins.hs
Last active August 29, 2015 14:20
laundryCoins.hs
#!/usr/bin/env runhaskell
module Main where
data Coin = Quarter | Loonie deriving (Eq, Show)
type Cents = Int
cents :: Coin -> Cents
cents Quarter = 25
cents Loonie = 100
@srid
srid / foo.py
Created February 13, 2009 20:14
import os, sys
def hello():
print "Hello World!"
if __name__ == "__main__":
hello()
/*
Ubiquity Command: download-files [regexp pattern] to [folder]
Author: Duane Johnson
Email: duane.johnson@gmail.com
Description: Downloads files matching the regular expression pattern to a folder.
See: http://github.com/canadaduane/ubiquity-download-files
*/
@srid
srid / healthyeyes-daemon.sh
Created February 23, 2009 16:30
Notify every 20 mins - requires NotifyOSD from Ubuntu Jaunty
while true; do
notify-send -t 20000 "Take a break?" "Just look away and blink your eyes"
sleep 1200;
done
srid@homeless:~/code/gnusim8085$ git branch; git svn info
master
* ui-file-management
Path: .
URL: https://gnusim8085.svn.sourceforge.net/svnroot/gnusim8085/tags/1.3.5
Repository Root: https://gnusim8085.svn.sourceforge.net/svnroot/gnusim8085
Repository UUID: c0c784df-5f15-0410-a540-c3e77be2c7b8
Revision: 136
Node Kind: directory
Schedule: normal
def test_typical_usecase():
"""Test the typical use case, which is to -
1) update 2) search 3) install 4) remove
.. and 5) import
"""
packages = packages_small_list
c, repo_root_url = prepare_client(packages)
c.do_update(None, None, repo_root_url)
# an example of ordered test runs using yield
def test_typical_usecase():
"""Test the typical use case, which is to -
1) update 2) search 3) install 4) remove
.. and 5) import
"""
c, repo_root_url = prepare_client(packages_small_list)