I hereby claim:
- I am gchiam on github.
- I am gchiam (https://keybase.io/gchiam) on keybase.
- I have a public key whose fingerprint is 7628 D70D 2B68 1304 86DB B346 BAE1 0BD7 51A0 125E
To claim this, I am signing this object:
"""Testing chromote library. | |
https://github.com/iiSeymour/chromote | |
""" | |
from __future__ import print_function | |
import itertools | |
import time | |
from chromote import Chromote |
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]: |
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 | |
# 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 |
from __future__ import print_function | |
import abc | |
import functools | |
class BaseContextDecorator(object): | |
__metaclass__ = abc.ABCMeta | |
def __call__(self, func): |
infocmp xterm-256color > /tmp/xterm-256color.terminfo | |
cp /tmp/xterm-256color.terminfo /tmp/xterm-256color.terminfo.origial # backup | |
printf '\tsitm=\\E[3m, ritm=\\E[23m,\n' >> /tmp/xterm-256color.terminfo | |
tic /tmp/xterm-256color.terminfo | |
infocmp screen-256color > /tmp/screen-256color.terminfo | |
cp /tmp/screen-256color.terminfo /tmp/screen-256color.terminfo.origial # backup | |
printf '\tsitm=\\E[3m, ritm=\\E[23m,\n' >> /tmp/screen-256color.terminfo | |
tic /tmp/screen-256color.terminfo |
class Singleton(type): | |
"""A singleton metaclass. | |
Usage: | |
class Foo(object): | |
__metaclass__ = Singleton | |
assert Foo() is Foo() | |
""" |
from itertools import izip_longest | |
def get_chunks(size, parts): | |
ranges = list(range(0, size, size // (parts - 1))) | |
return list(izip_longest(ranges, ranges[1:], fillvalue=size)) | |
if __name__ == '__main__': | |
size = 500 |
I hereby claim:
To claim this, I am signing this object:
class Root(object): | |
def setup(self): | |
print 'Root.setup' | |
class Base(Root): | |
def setup(self): | |
print 'Base.setup' | |
super(Base, self).setup() |