This file contains hidden or 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
| SUCCESS_BEEPS=2 | |
| ERROR_BEEPS=5 | |
| prog=$1 | |
| shift | |
| args=$@ | |
| function countbeep() { | |
| head -c $1 < /dev/zero | tr '\0' "\a" | |
| } |
This file contains hidden or 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
| /* | |
| This is inspired by the "Using Bootstrap the Right (Semantic) Way" article | |
| https://www.ostraining.com/blog/coding/bootstrap-right-way/ | |
| Every time I added a table to a page, I was always adding bootstrap classes to it, like so: | |
| <table class="table table-bordered table-striped"> | |
| This LESS file automatically gives all tables the styles from these classes. |
This file contains hidden or 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
| def log_gen(n): | |
| import math | |
| y = 1 | |
| while y < n: | |
| adder = max(1, math.pow(10, int(math.log10(y)))) | |
| yield int(y) | |
| y = y + adder |
This file contains hidden or 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
| property file_formats : {¬ | |
| "cfm", ¬ | |
| "html", ¬ | |
| "js", ¬ | |
| "py", ¬ | |
| "sh", ¬ | |
| "txt"} | |
| property scratch_folder : "Macintosh HD:path:to:scratch:folder:" as alias |
This file contains hidden or 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
| window.console = window.console || (function() { | |
| var empty = function () {}, | |
| functions = "log info warn error assert dir clear profile profileEnd".split(" "), | |
| ff = 0, | |
| fun = null, | |
| return_obj = {}; | |
| for(ff = 0; fun = functions[ff]; ff += 1) { | |
| return_obj[fun] = empty | |
| } | |
| return return_obj |
This file contains hidden or 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 errno | |
| import os | |
| import paramiko | |
| class Uploader(object): | |
| def __init__(self, host, basepath='', username=None, password=None, keyfile=None, *args, **kwargs): | |
| self.host = host | |
| self.basepath = basepath | |
| self.username = username |
This file contains hidden or 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 | |
| # | |
| # Helper functions for Django projects in virtual env | |
| # | |
| # include in your .bashrc file: | |
| # | |
| # . ~/django_env_functions.sh | |
| # | |
| $MANAGE_PATH = "project/code" |
This file contains hidden or 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 subprocess, threading | |
| class Command(object): | |
| ''' | |
| Enables to run subprocess commands in a different thread | |
| with TIMEOUT option! | |
| Based on jcollado's solution: | |
| http://stackoverflow.com/questions/1191374/subprocess-with-timeout/4825933#4825933 | |
| ''' |
NewerOlder