Skip to content

Instantly share code, notes, and snippets.

Avatar

Ratandeep Ratti rdsr

View GitHub Profile
@rdsr
rdsr / user_rb_comments
Last active May 19, 2016
Python script to pull all reviews a user has commented on Works with Review Board 2.0.18
View user_rb_comments
#!/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 / about.md
Created Aug 13, 2011 — forked from anujmaurice/about.md
Programming Achievements: How to Level Up as a Developer
View about.md
View strange_pattern.ss
(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))
View project_euler_problem_18_67.clj
(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)
View draw_line.ss
(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)))
View segments_painter.ss
(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)))
View project_euler_problem_22.clj
(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
View project_euler_problem_17.clj
(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")
View pe_problem_21_fragment1.clj
(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))))
You can’t perform that action at this time.