Skip to content

Instantly share code, notes, and snippets.

View samliu's full-sized avatar

Sam Liu samliu

View GitHub Profile

Keybase proof

I hereby claim:

  • I am samliu on github.
  • I am samliu (https://keybase.io/samliu) on keybase.
  • I have a public key whose fingerprint is 981F CF58 9F14 FB0B DEDC 1B63 7EB4 5F83 B086 4885

To claim this, I am signing this object:

@samliu
samliu / snipe.py
Created October 26, 2015 22:40
A quick script I wrote to calculate how much money we'd need to contribute to Swedish Delight's entrance to the Super Smash Brothers (game) Summit. This was a competitive donation event, so it was necessary to understand at all times how much money we'd need on hand at a minimum.
# !/usr/bin/env python
#
# Initial Author: Samuel C. Liu <sam@ambushnetworks.com>
#
# Description: Parse smash.gg to get current numbers for James.
#
# requirements.txt:
# beautifulsoup4 == 4.4.1
from bs4 import BeautifulSoup
import os
# samliu@'s Amazon Button Doorbell!
#
# OS X only. Uses AppleScript to play a track from Spotify and "say" tts to
# inform you that someone's at the door. You should have Spotify installed.
#
# Based on example from: http://bit.ly/1WFAPAb
# Your Button's MAC Address.
BUTTON1_MAC_ADDRESS = "00:00:00:00:00:00"
class ColorPrinter(object):
"""Class to print with color."""
def __init__(self):
self.colors = {
"HEADER": '\033[95m',
"OKBLUE": '\033[94m',
"OKGREEN": '\033[92m',
"WARNING": '\033[93m',
"FAIL": '\033[91m',
"ENDC": '\033[0m',
Verifying I am +samliu on my passcard. https://onename.com/samliu
# textanalysis.py
#
# Analyzing iphone text message csv dump from iBackup Viewer
# (http://www.imactools.com/iphonebackupviewer/)
#
# Requirements:
# - WordCloud (http://github.com/amueller/word_cloud)
#
# How to use:
# 1. Generate csv dump via iphonebackupviewer and point to it in __main__
@samliu
samliu / osx_sleeptimer.py
Last active August 6, 2017 09:32
Sleep timer for itunes and spotify on the command line (for OSX only)
#!/usr/bin/env python
from datetime import datetime, timedelta
import time
import sys
import os
if len(sys.argv) is 3:
music_service = str(sys.argv[1])
minutes_to_wait = float(sys.argv[2])
else:
@samliu
samliu / scrapy.py
Created June 22, 2012 23:11
manage command for django to call scrapy
# Enable us to call scrapy from manage.py
from __future__ import absolute_import
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def run_from_argv(self, argv):
self._argv = argv
self.execute()
@samliu
samliu / url_dsl.rb
Created December 14, 2009 22:09 — forked from defunkt/url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json