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
def get_addr_range(start, end): | |
def to_int(ip): | |
return sum([int(p) << (24 - (8 * e)) for e, p in enumerate(ip.split("."))]) | |
def to_ip(val): | |
return ".".join(str((val & (0xff << s)) >> s) for s in range(24, -1, -8)) | |
for addr in xrange(to_int(start), to_int(end) + 1): | |
yield to_ip(addr) |
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 functools | |
import flask | |
import inspect | |
import sys | |
import traceback | |
def infer_args(func): | |
argspec = inspect.getargspec(func) | |
if argspec.defaults is None: |
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
class A | |
def foo | |
puts "A" | |
end | |
def self.bar | |
puts "B" | |
end | |
end |
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 | |
function error { | |
echo -e ">>>>>>>>>>>>>>>>>>>>>>\n$@\n<<<<<<<<<<<<<<<<<<<<<<" | |
} | |
set -e | |
if [ -e test ]; then | |
echo "'test/' already exists" |
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
<snippet> | |
<content><![CDATA[ | |
package ${TM_FILEPATH/(.*((?<pfx>com|net|uk|org)\/))?(?<dir>[^\/]+)\/([^\/]+$)?/$+{pfx}.$+{dir}/g}; | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>package</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.java</scope> | |
<description>Automatically calculate package line from file path</description> | |
</snippet> |
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
cdef extern from "unistd.h": | |
cdef void sleep(int time) | |
def lock(time): | |
print "starting to block" | |
sleep(10) | |
print "stop blocking" | |
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.7 | |
""" | |
Copy data from one redis instance to another | |
""" | |
import argparse | |
import sys | |
# pip install redis fin |
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
// Less color functions are absolute, i.e. if you lighten a really light color by 50%, you'll probably just get pure-white, | |
// because lighten works relative to the full scale from black -> white | |
// These functions shift a color relative to it's current value, (if you have a 50% grey, and shift it by 50%, you should end up with a 75% grey) | |
// Because less doesn't support functions as well as I would like, the solution is quite hacky. | |
// To set a property to a shifted value, call .color_shift, passing it in. | |
// For example: .color_shift(background, blue, 70%); produces: background: #b3b3ff; (light-blue) | |
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 python | |
import sys | |
import argparse | |
def parse_args(args=None): | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-v", "--verbose", action="count", default=0, | |
help="Increase verbosity", dest="verbosity") |
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
mount /dev/sdX2 root | |
cd root | |
pacman -r . --config etc/pacman.conf --arch armv6h -S wpa_actiond wpa_supplicant |
OlderNewer