Skip to content

Instantly share code, notes, and snippets.

@vedang
vedang / psk.clj
Last active Feb 1, 2019
A Clojure simulation of the Passport Seva Kendra
View psk.clj
(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.
@vedang
vedang / keybase.md
Last active Aug 29, 2015
Keybase Verification
View keybase.md

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 / uniquify-recentf.el
Created Jan 27, 2014
Implements functionality similar to `uniquify' to make `recentf' results bearable.
View uniquify-recentf.el
(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 / redis.clj
Created Oct 8, 2013
A gist to demonstrate how the redis API can be wrapped in Hystrix.
View redis.clj
(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}})
View routes.clj
(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 / switch-speed.py
Created Aug 7, 2011
a simple speed test for python switching
View switch-speed.py
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 / run-or-raise-emacs.sh
Created Aug 7, 2011
Shell script to start a new instance of emacs or switch to an already running one.
View run-or-raise-emacs.sh
#!/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 / pascal.clj
Created Jul 10, 2011
printing Pascal's Triangle.
View pascal.clj
(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)) ))
View filling-frames.clj
;;; 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
View SarPassTrek
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
You can’t perform that action at this time.