Skip to content

Instantly share code, notes, and snippets.

View gchiam's full-sized avatar

Gordon Chiam gchiam

View GitHub Profile
from __future__ import print_function
import abc
import functools
class BaseContextDecorator(object):
__metaclass__ = abc.ABCMeta
def __call__(self, func):
@gchiam
gchiam / gist:7f8f302cd460d8a300db333e55445654
Created April 19, 2016 03:15 — forked from dedy-purwanto/gist:11312110
Bulk remove iTerm2 color schemes.
# There was a day where I have too many color schemes in iTerm2 and I want to remove them all.
# iTerm2 doesn't have "bulk remove" and it was literally painful to delete them one-by-one.
# iTerm2 save it's preference in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files.
$ cd /tmp/
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist .
$ plutil -convert xml1 com.googlecode.iterm2.plist
$ vi com.googlecode.iterm2.plist
@gchiam
gchiam / ubuntu_setup.sh
Last active November 3, 2016 04:24
ubuntu set
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install -y openssh-server
sudo apt-get install -y git
sudo apt-get install -y build-essential
sudo apt-get install -y python-dev python3-dev
sudo apt-get install -u libtool libtool-bin autoconf automake cmake g++ pkg-config unzip gperf
In [1]: from itertools import zip_longest
In [2]: size = 500
In [3]: parts = 16
In [4]: ranges = list(range(0, size, size // parts))
In [5]: ranges
Out[5]:
"""Testing chromote library.
https://github.com/iiSeymour/chromote
"""
from __future__ import print_function
import itertools
import time
from chromote import Chromote
@gchiam
gchiam / spam1.py
Last active October 15, 2015 03:50
fallback import (python3 only)
# spam.py
try:
import foo
except ImportError:
import simplefoo as foo
@gchiam
gchiam / tmux-theme-gruvbox.conf
Created October 7, 2015 00:34
gruvbox color scheme for tmux
# This tmux statusbar config was created based on gruvbox colorscheme
set -g status "on"
set -g status-justify "left"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-right-attr "none"
set -g status-attr "none"
set -g status-utf8 "on"
set -g status-left-attr "none"
@gchiam
gchiam / gruvbox.yml
Created October 6, 2015 23:58
Color scheme for base16-builder based on gruvbox color scheme
# Color scheme for base16-builder based on gruvbox color scheme
# (https://github.com/morhetz/gruvbox).
# [1] gruvbox.yml
scheme: "Gruvbox"
author: "Gordon Chiam (https://github.com/gchiam)"
base00: "282828"
base01: "504945"
base02: "7c6f54"
base03: "ebdbb2"
base04: "bdae93"
@gchiam
gchiam / simpleworkflow.py
Last active September 30, 2015 01:47
Simple Workflow Engine
import functools
import logging
class SimpleWorkflowEngine(object):
"""A simple workflow engine
Usage:
from functools import partial
def initialize(number):
@gchiam
gchiam / dashing.py
Created September 9, 2015 00:02
Python module to send data to Dashing widget
"""Dashing module"""
import logging
import urllib2
import simplejson as json
DEFAULT_DASHING_AUTH_TOKEN = 'YOUR_AUTH_TOKEN'