Skip to content

Instantly share code, notes, and snippets.

View rajadain's full-sized avatar

Terence Tuhinanshu rajadain

View GitHub Profile
@rajadain
rajadain / keybase.md
Created March 30, 2014 17:42
Keybase.io verification

Keybase proof

I hereby claim:

  • I am rajadain on github.
  • I am rajadain (https://keybase.io/rajadain) on keybase.
  • I have a public key whose fingerprint is 325A F5CB CCBC 481F E244 1E3A B4E7 1755 48AD 5DBE

To claim this, I am signing this object:

@rajadain
rajadain / graycode.py
Created December 7, 2012 05:24
Graycode generator
def graycode(n):
a = [0]*n
for i in range(0,pow(2,n)):
b = 'X'
for j in range(0,n):
if ((i % pow(2,j+1)) - pow(2,j) == 0):
a[j] = pow(1 - a[j], 2)
b = j
break
print i, "".join((map(str,a)))[::-1], b
@rajadain
rajadain / shorthandles.php
Created December 9, 2012 05:55
Finding Short Twitter Handles
<?php
for ($i = 97; $i < 122; $i++) {
for ($j = 0; $j < 100; $j++) {
$usn = chr($i) . strval($j);
$url="http://api.twitter.com/1/users/show.json?screen_name=".$usn;
$json = file_get_contents($url,0,null,null);
if ($http_response_header[0] == "HTTP/1.1 404 Not Found ")
echo "<p style='color:red'>$usn is available.</p>";
else
echo "<p style='color:grey'>$usn is not available.</p> ";
@rajadain
rajadain / README.md
Last active August 9, 2017 20:44
PNG to GeoTrellis ColorMap

Requirements

Demo

$ ./convert.sh ppt_colorbar.png
+ gm convert ppt_colorbar.png txt:-
@rajadain
rajadain / haskellbook-chapter-10-notes.md
Created August 22, 2017 07:39
Haskell Book Chapter 10 Notes and Exercises

Notes and Exercises from Chapter 10 of Haskell Book

Undefined Spine vs Undefined Item

[1, 2, 3] ++ undefined
 :
@rajadain
rajadain / 11-exercise-phone.hs
Created September 5, 2017 20:10
Haskell Book Chapter 11 Exercise: Phone
-- 11-exercise-phone.hs
module ExercisePhone where
import Data.Char
import Data.List
import Data.Maybe
type Key = Char
type Presses = Int
@rajadain
rajadain / haskellbook-chapter-13-hangman.hs
Created September 19, 2017 01:44
Haskell Book Chapter 13
module Main where
import Control.Monad (forever)
import Data.Char (toLower)
import Data.Maybe (isJust)
import Data.List (intersperse, nub)
import System.Exit (exitSuccess)
import System.Random (randomRIO)
import System.IO
@rajadain
rajadain / bigcz-differing-dates.ipynb
Last active September 28, 2017 14:02
Notebook showing differing dates from CUAHSI
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rajadain
rajadain / bigcz-cocorahs-fail.ipynb
Created October 29, 2017 19:20
Demo of ULMO failure when fetching data for CoCoRAHS service
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.