Skip to content

Instantly share code, notes, and snippets.

View vedang's full-sized avatar
🐢
Slow and steady

Vedang Manerikar vedang

🐢
Slow and steady
View GitHub Profile
List of Things required for the Sarpass Trek
============================================
1. Medical form signed by Doctor. (This is COMPULSORY document)
2. Temporary / Permanent YHAI membership card.
3. Get latest passport size photos
4. Rucksack
5. cotton shirts
6. 2 denim jeans
7. woolen jersey or jacket
;;; section 2.6.1
;;; Generate designs by having a function act on x and y co-ordinates in a frame
;;; Define a frame and grab it's graphics context
(def frame (java.awt.Frame.))
(.setVisible frame true)
(def gfx (.getGraphics frame))
;;; Our generator function
(defn f-values
@vedang
vedang / pascal.clj
Created July 10, 2011 16:46
printing Pascal's Triangle.
(defn pascal-val
"function to calculate value of element at a particular row and column
for the pascal triangle."
[r c]
(cond
(= c 0) 1
(= c r) 1
:else (+ (pascal-val (- r 1) (- c 1))
(pascal-val (- r 1) c)) ))
@vedang
vedang / run-or-raise-emacs.sh
Created August 7, 2011 11:28
Shell script to start a new instance of emacs or switch to an already running one.
#!/bin/bash
# get id of emacs
win=$(xdotool search --onlyvisible --class emacs | head -1)
if [ "x$win" = x ]; then
# Emacs is not running
# switch to viewport 1, which is my coding viewport
~/incoming-src/dotfiles/scripts/compiz-send.py vpswitch switch_to_1_key
gxmessage -center -timeout 2 -nofocus -buttons "" -borderless "loading emacs..."&
# start Emacs
@vedang
vedang / switch-speed.py
Created August 7, 2011 12:57
a simple speed test for python switching
from timeit import Timer
from random import randint
def switch_if():
value = randint(1, 10)
if value == 1:
return '1'
elif value == 2:
return '2'
@vedang
vedang / routes.clj
Created February 23, 2012 16:24
A simple example to go with my post on Compojure. http://vedang.me/techlog/2012/02/23/composability-and-compojure/
(ns cello-world.routes
(:require [compojure.route :as route]
[compojure.core :as cc]
[ring.util.response :as rur])
(:use [ring.adapter.jetty :only [run-jetty]]))
(cc/defroutes hello-routes
(cc/GET "/hello/name/" []
(fn [req]
@vedang
vedang / redis.clj
Created October 8, 2013 17:13
A gist to demonstrate how the redis API can be wrapped in Hystrix.
(ns example.hystrix.redis
(:require [com.netflix.hystrix.core :as hystrix]
[taoensso.carmine :as car :refer [wcar]])
(:refer-clojure :exclude [time get set key keys type sync sort eval]))
(def server-spec {:spec {:host "127.0.0.1"
:port 6379}
:pool {:max-active 8}})
@vedang
vedang / uniquify-recentf.el
Created January 27, 2014 08:59
Implements functionality similar to `uniquify' to make `recentf' results bearable.
(require 'recentf)
;; Implement functionality similar to uniquify to make recentf results bearable
;; Requires s.el and dash.el - awesome libraries from Magnar Sveen
;; Hat-tip : Baishampayan Ghose for the clojure implementation at
;; https://gist.github.com/ghoseb/8432086
(require 's)
(require 'dash)
@vedang
vedang / keybase.md
Last active August 29, 2015 14:07
Keybase Verification

Keybase proof

I hereby claim:

  • I am vedang on github.
  • I am vedang (https://keybase.io/vedang) on keybase.
  • I have a public key whose fingerprint is 64C0 579D EA73 EADC B9FE DD2D 02C8 3321 60B8 648C

To claim this, I am signing this object:

@vedang
vedang / psk.clj
Last active May 11, 2020 03:12
A Clojure simulation of the Passport Seva Kendra
(ns challenges.psk
"A Simulation of the Passport Seva Kendra"
(:require [clj-time.core :as ct]
[clojure.tools.logging :as ctl])
(:import [java.util.concurrent LinkedBlockingQueue PriorityBlockingQueue]))
(def working-hours? (atom false)) ; use this to control agents.
; Turning this off will
; shutdown agents.