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
@Ceasar
Ceasar / manufactoria.hs
Created Jun 26, 2013
Simulation of manufactoria. WIP.
View manufactoria.hs
import qualified Data.Map as M
data Direction = N | S | E | W deriving Eq
type Location = (Int, Int)
data Sticker = Red | Blue deriving Eq
data Widget = Widget Location [Sticker]
View first_principles.py
"""
"""
import inspect
import re
import pprint
FUNCTION_PATTERN = re.compile(".*\s((\.|\w)+)\(")
View 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))
View better_loader.py
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2011 by Armin Ronacher.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import unittest
View .localrc.sh
# Start postgres
alias pgstart='pg_ctl -l $PGDATA/server.log start'
# Stop postgres
alias pgstop='pg_ctl stop -m fast'
# Postgres stuff
export PGDATA='/usr/local/var/postgres'
# Register a python project on pypi
@Ceasar
Ceasar / dotfiles.txt
Last active Dec 17, 2015
List of my dotfiles. For use with [dots](https://github.com/Ceasar/dots).
View dotfiles.txt
git@github.com:Ceasar/dot_zsh.git
git@github.com:Ceasar/dot_vim.git
git@github.com:Ceasar/dot_gitconfig.git
git@github.com:Ceasar/dotfiles.git
@Ceasar
Ceasar / email_validator.py
Created Apr 22, 2013
Email Validator for wtforms using Django validator.
View email_validator.py
class Email(object):
message = 'Enter a valid email address.'
user_regex = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*$" # dot-atom
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"$)', # quoted-string
re.IGNORECASE)
domain_regex = re.compile(
r'(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?$)' # domain
# literal form, ipv4 address (SMTP 4.1.3)
r'|^\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$',
@Ceasar
Ceasar / send.rb
Created Apr 4, 2013
Send a text to a number from multiple numbers.
View send.rb
##
# sms_bomb
# ========
#
# Send a bunch of texts (from multiple numbers) to a target number.
#
# Installation
# ------------
#
# `gem install twilio-ruby`
@Ceasar
Ceasar / connect.py
Created Apr 3, 2013
Connect and stayed connected to AirPennNet.
View connect.py
import sys
import time
from sh import networksetup
DEVICE = 'en0'
NETWORK = u'AirPennNet'
def connect_to_network(network):
@Ceasar
Ceasar / ex1.py
Last active Dec 14, 2015
Experiments with scope in Python.
View ex1.py
"""
Python scope is not dynamic.
"""
def foo():
print x
x = 0
You can’t perform that action at this time.