Skip to content

Instantly share code, notes, and snippets.

View rdsr's full-sized avatar

Ratandeep Ratti rdsr

  • LinkedIn!
  • Sunnyvale, CA
View GitHub Profile
@rdsr
rdsr / user_rb_comments
Last active May 19, 2016 18:45
Python script to pull all reviews a user has commented on Works with Review Board 2.0.18
#!/usr/bin/env python2.6
"""
Python script to pull all reviews a user has commented on
Works with Review Board 2.0.18
"""
import site
site.addsitedir('/usr/local/linkedin/lib/python2.6/site-packages')
@rdsr
rdsr / springer-free-maths-books.md
Created December 28, 2015 12:11 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@rdsr
rdsr / about.md
Created August 13, 2011 09:26 — forked from anujmaurice/about.md
Programming Achievements: How to Level Up as a Developer
(325 (10 15) (6 17) (1 18)) ;; 325 = 10^2 + 15^ = 6^2 + 17^2 = 1^2 + 18^2
(425 (13 16) (8 19) (5 20))
(650 (17 19) (11 23) (5 25))
;; ...
;; ...
;; ...
(5050 (45 55) (17 69) (3 71))
(5125 (47 54) (34 63) (30 65))
(use '[clojure.contrib.duck-streams :only (reader read-lines)])
(defn build-sum-mtx [triangle]
(let [len (count triangle)]
(loop [mtx [] i 0]
(cond
(= i len) mtx
:else (let [row (get mtx (dec i))
sum (fn [n j]
(let [a (or (get row (dec j)) 0)
(define image (line 0 0 'white))
(define (draw-line v1 v2)
(set! image
(add-line image
(xcor-vect v1) ; x-coordinate ...etc
(ycor-vect v1)
(xcor-vect v2)
(ycor-vect v2)
'black)))
(define (segments->painter segment-list)
(lambda (frame)
(for-each
(lambda (segment)
(draw-line
((frame-coord-map frame) (start-segment segment))
((frame-coord-map frame) (end-segment segment))))
segment-list)))
(use '[clojure.contrib.duck-streams :only (reader read-lines)])
(def letter->index
{\A 1
\B 2
\C 3
\D 4
\E 5
\F 6
\G 7
(def number->wrd-cnt
{1 (count "one")
2 (count "two")
3 (count "three")
4 (count "four")
5 (count "five")
6 (count "six")
7 (count "seven")
8 (count "eight")
9 (count "nine")
(defn amicable? [a]
(if (@amicable-nos a) true
(let [b (d a)
db (d b)]
(if (and (not= a b) (= a db))
(do (swap! amicable-nos assoc b true) true)
false))))