Skip to content

Instantly share code, notes, and snippets.

View samliu's full-sized avatar

Sam Liu samliu

View GitHub Profile
# 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__
Verifying I am +samliu on my passcard. https://onename.com/samliu
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',
# 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"
@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
@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 / 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

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:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@samliu
samliu / binary_converter.py
Created June 7, 2017 06:00
Translate a postsecret's binary
# Translate binary into english characters.
# Written to translate a PostSecret on 01-24-2016.
#
# Author: Sam Liu <sam@ambushnetworks.com>
#
# 01001001001000000110101101101110011011110111
# 01110010000001001001001001110110110100100000
# 01100001001000000110011101100101011001010110
# 10110010111000100000010010010010011101101101
# 001000000111000001110010011011110111010101100