Skip to content

Instantly share code, notes, and snippets.

Ceasar Bautista Ceasar

Block or report user

Report or block Ceasar

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
View fabfile.py
"""
fab -H [hostname] [command]
"""
from fabric.api import run
HOME = '/Users/ceasarbautista'
def authorize():
View connect.py
import sys
import time
from sh import networksetup
DEVICE = 'en0'
NETWORK = u'AirPennNet'
NETWORK = u'Lovers&Madmen'
View basins.py
"""
Palantir interview question.
The goal is to, given an elevation map of some land, print out a
list of basin sizes in descending order, where a basin is a set of
cells of land that all drain to a common point. One cell drains to
another if among the first cell and its neighbors (i.e. cells adjacent,
horizonatlly, vertically or diagonally) the second cell has the lowest
elevation.
@Ceasar
Ceasar / Lisp.hs
Created Jul 27, 2013
Lisp in Haskell. WIP.
View Lisp.hs
import Text.ParserCombinators.Parsec
import System.Environment
data LispVal = Atom String
-- | List [LispVal]
-- | DottedList [LispVal] LispVal
| Number Integer
| String String
@Ceasar
Ceasar / Logic.lhs
Created Jul 26, 2013
Propositional logic.
View Logic.lhs
> import Data.Set as S
> import Data.Map as M
> import Data.Maybe
> import Control.Monad (liftM, liftM2)
> import Test.QuickCheck
A statement is a sentence that is determinately true of determinately false independently of the circumstances in which it is used.
> data Proposition = Implies Proposition Proposition
View speed_primes.py
import timeit
setup = """
def primes(n):
'''Get all primes up to n.'''
if n < 2:
return []
nums = range(n)
sieve = set(xrange(2, n))
@Ceasar
Ceasar / Chess.hs
Created Jul 26, 2013
WIP Haskell chess.
View Chess.hs
module Chess where
import Data.Map as M
import Test.HUnit
import Test.QuickCheck
type Pos = (Int, Int)
data Color = White | Black
@Ceasar
Ceasar / xml2json.py
Created Jul 26, 2013
Convert xml to json.
View xml2json.py
'''A module for converting xml into json.'''
import json
from lxml import etree
def xml_to_json(xml_input, json_output):
'''Converts an xml file to json.'''
dict_to_json(etree_to_dict(xml_to_etree(xml_input), True), json_output)
@Ceasar
Ceasar / scrape_tables.py
Created Jul 26, 2013
Scrape tables off a web page.
View scrape_tables.py
"""
Covert html tables into csvs.
"""
import sys
import urllib
from lxml import etree
View md2.py
"""
Convert markdown files containing Python code into working Python files.
Usage: python md2.py [markdownfile]
Example:
Flask is Fun
============
You can’t perform that action at this time.