Skip to content

Instantly share code, notes, and snippets.

Umair Saeed umairsd

Block or report user

Report or block umairsd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@umairsd
umairsd / Big List of Real Estate APIs.md
Created Apr 21, 2019 — forked from patpohler/Big List of Real Estate APIs.md
Evolving list of Real Estate APIs by Category
View Big List of Real Estate APIs.md

Big List of Real Estate APIs

Listings / Property Data

####Rets Rabbit http://www.retsrabbit.com

Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.

@umairsd
umairsd / PythonSetup.md
Last active Feb 3, 2019
Commands and tricks about Python.
View PythonSetup.md

Virtual Environments

Creating a virtual environment (by default, this will not include any of existing site packages):

# Python 3.6 and above
$ python3 -m venv ~/.virtualenv/<env-name>

In order to use this environment’s packages/resources in isolation, you need to “activate” it. To do this, just run the following:

View RegEx-Dates
\w{3}\s\d+,\s\d{4}
Matches both "May 15, 1980", and "May 5, 1980"
@umairsd
umairsd / parse-read-books.py
Created Nov 26, 2016
Mini-script to parse my read-books file
View parse-read-books.py
with open('books.txt') as f_old, open('newbook.txt', 'w+') as f_new:
for line in f_old:
if "[" in line and "]" in line:
# Process the line only if it has the "[" and "]" characters
book_name, sep1, old_date_str = line.partition("[")
_, _, book_name = book_name.partition("-")
month, _, tmp = old_date_str.partition("/")
day, _, tmp = tmp.partition("/")
year, _, _ = tmp.partition("]")
@umairsd
umairsd / program.js
Last active Jan 6, 2016
Solution to Juggling Async problem (Learn You the Node.js)
View program.js
// Note: Does not use any external node.js packages.
// *** Exercise 9: JUGGLING ASYNC
var http = require('http');
var count = 3;
var urls = process.argv.slice(2);
var results = [];
function httpGet(index)
@umairsd
umairsd / huffman.hs
Created Oct 7, 2015
Huffman Codes - Creates a Huffman Tree from passed in array of (key, probability) pairs, and then generates all the codes by iterating over the tree (P50 in 99 Haskell Problems)
View huffman.hs
-- Problem 50, 99 Haskell Problems (https://wiki.haskell.org/99_questions/46_to_50)
{-# OPTIONS_GHC -Wall #-}
import Data.Ord(comparing)
import Data.List(sortBy)
huffman :: [(Char, Int)] -> [(Char, String)]
huffman = sortBy (comparing fst) . (serializeHTree . buildHTree . createHTreeList)
@umairsd
umairsd / miscellaneous.hs
Created Oct 3, 2015
General purpose Haskell functions
View miscellaneous.hs
-- a function that's equivalent to the standard library's sequence function
myseq ms = foldr k ([[]]) ms
where k m m' = [x:xs | x <- m, xs <- m']
-- another variant of the sequence function, uses return [] instead of [[]]
myseq1 ms = foldr k (return []) ms
where k m m' = [x:xs | x <- m, xs <- m']
View arithmetic.hs
-- Miscellaneous arithmetic functions
-- Square roots using Newton's method
sqrtNewton :: (Floating a, Ord a) => a -> a
sqrtNewton n = head $ dropWhile (\g -> abs(n - g^2) > tolerance) $ iterate (newGuess n) 1
where
tolerance = 0.000001
newGuess :: Floating a => a -> a -> a
newGuess n oldGuess = (oldGuess + n / oldGuess) / 2
@umairsd
umairsd / pascal-triangle.hs
Last active Aug 29, 2015
Pascal's Triangle
View pascal-triangle.hs
-- Takes an array of integers, and adds pairs of numbers to create a new
-- array. For example, [1,2,3,4] changes to [(1+2), (2+3), (3+4)], resulting
-- in [3,5,7]
sumOfPairs :: [Integer] -> [Integer]
sumOfPairs [] = []
sumOfPairs (x:[]) = []
sumOfPairs (x:y:ys) = (x+y) : sumOfPairs (y:ys)
-- Given a row of Pascal's triangle, returns the next row
View list-index-ops.hs
-- Index based list operations using folds
--
-- Author: Umair Saeed
-- Date: 05/17/2015
--
-- insert at an index, implemented via foldr
insertAt :: a -> [a] -> Int -> [a]
insertAt x ys n = foldr insertHelper [] $ zip [0..] ys
where
You can’t perform that action at this time.