This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import sys | |
import os | |
import hashlib | |
def chunk_reader(fobj, chunk_size=1024): | |
"""Generator that reads a file in chunks of bytes""" | |
while True: | |
chunk = fobj.read(chunk_size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define('Underscore', { | |
singleton: true, | |
constructor: function() { | |
// Underscore.js 1.8.3 | |
// http://underscorejs.org | |
// (c) 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
// Underscore may be freely distributed under the MIT license. | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function urlDecode(query) { | |
var queryString = query || window.location.search.slice(1), | |
decodeFn = window.decodeURIComponent, | |
options = decodeFn(queryString).split('&'), | |
pair, i, ret = {}; | |
for (i = 0; i < options.length; ++i) { | |
pair = options[i].split('='); | |
ret[pair[0]] = pair[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, itertools | |
from multiprocessing import Pool | |
def do_permutations(string): | |
for i in itertools.permutations(string): | |
pass | |
return 'Done count permutations of ' + string | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# git-mv-with-history -- move/rename file or folder, with history. | |
# | |
# Moving a file in git doesn't track history, so the purpose of this | |
# utility is best explained from the kernel wiki: | |
# | |
# Git has a rename command git mv, but that is just for convenience. | |
# The effect is indistinguishable from removing the file and adding another | |
# with different name and the same content. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Assuming: | |
* dataview is a { xtype: "list" } | |
* dataview.itemTpl includes a <div class="deleteplaceholder"></div> | |
* | |
* Delete button will disappear as soon as something is touched | |
*/ | |
dataview.on("itemswipe", function(dataview, ix, target, record, event, options) { | |
if (event.direction == "left") { | |
var del = Ext.create("Ext.Button", { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install nodejs | |
apt-get install npm | |
cd /usr/bin | |
ln -s nodejs node | |
npm install -g phantomjs | |
npm install -g casperjs | |
apt-get install libfreetype6-dev | |
apt-get install libfontconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User | |
git config --global user.name YOUR_NAME | |
git config --global user.email YOUR_EMAIL@gmail.com | |
git config --global core.editor vim | |
# Common | |
git config --global alias.st status | |
git config --global alias.ci commit | |
git config --global alias.co checkout | |
git config --global alias.br branch |
NewerOlder