Skip to content

Instantly share code, notes, and snippets.

@nkarnik
nkarnik / bashpro
Last active August 26, 2015 16:37
Bashpro
export CLICOLOR=1
export TERM=xterm-color
export JAVA_HOME=$(/usr/libexec/java_home)
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
@nkarnik
nkarnik / ca_lens.csv
Created December 15, 2014 09:32
5 Lenscrafter Stores in California
lenscrafter 37.787946 -122.403076 685 Market St CA 94105
lenscrafter 33.721162 -117.792653 13662 Jamboree Rd CA 92602
lenscrafter 37.292652 -121.989343 1620 Saratoga Ave CA 95129
lenscrafter 37.836586 -122.293834 5707 Christie Ave CA 94608
lenscrafter 34.076249 -118.375763 8471 Beverly Blvd CA 90048
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
J. Crew
Men's Warehouse
Zara
Macy's
Brooks Brothers
import zillabyte
import csv
cartodb_key = "YOUR_KEY_HERE"
map_name = "business_map"
class CartoEach:
def execute(self, controller, tup):
controller.emit({"tup" : tup, "cartodb_key" : cartodb_key, "map_name" : map_name})
@nkarnik
nkarnik / twilio_weather_text.py
Last active August 29, 2015 14:11
Zillabyte component that uses Twilio to send an SMS to a subscriber about the local weather forecast
import zillabyte
from twilio.rest import TwilioRestClient
def send_text(controller, tup):
# Register twilio client
twilio_client = TwilioRestClient(tup["twilio_sid"], tup["twilio_auth"])
try:
# Send message to recipient and wait 1 second (twilio SMS rate limit)
@nkarnik
nkarnik / zillaweather.py
Last active November 25, 2015 11:43
Zillabyte app that queries weather forecasts from a list of cities and sends an SMS with Twilio to local subscribers when it is expected to rain
import zillabyte
twilio_sid = "SID_HERE"
twilio_auth = "AUTH_HERE"
class TwilioEach:
def prepare(self, controller):
# Dictionary of phone numbers subscribed to cities (just for show with small sample, please use a
# REAL source when using a significant number of phone numbers)