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
""" | |
Easy version... | |
def qr_hash(prefix, data_to_hash): | |
qr = "" | |
for char in prefix: | |
qr += hex(ord(char))[2:] | |
qr += md5(data_to_hash).hexdigest() | |
return qr | |
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
function toOrdinalHexString(str) { | |
ret = ""; | |
for (i=0; i < str.length; i++) { | |
c = str.charAt(i); | |
ret = ret.concat(c.charCodeAt(0).toString(16)); | |
} | |
return ret; | |
} |
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
<?php | |
function toQRCode($prefix, $str) { | |
$prefixOrd = ""; | |
for ($i = 0; $i < strlen($prefix); $i++) { | |
$c = substr($prefix, $i, 1); | |
$prefixOrd.= dechex(ord($c)); | |
} | |
return $prefixOrd.md5($str); | |
} |
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 star_url(url): | |
""" | |
Rebuild a URL with stars covering the password. | |
""" | |
url = urlparse(url) | |
ret = "" | |
# Scheme (http/https) | |
if url.scheme: | |
ret += "%s://" % url.scheme | |
# Username/password |
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 serial | |
import socket | |
import argparse | |
import sys | |
from time import sleep | |
NEWLINE = "\r\n" | |
def connect_tcp(sock, target): |
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
In [1]: s = lambda i: "s"[i==1:] | |
In [2]: for i in range(0, 5): | |
...: print "I have %d apple%s" % (i, s(i)) | |
...: | |
I have 0 apples | |
I have 1 apple | |
I have 2 apples | |
I have 3 apples | |
I have 4 apples |
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 os | |
from distutils.version import LooseVersion as Version | |
if __name__ == "__main__": | |
cb_versions = {} | |
for cb_dir in os.listdir("."): | |
if cb_dir.startswith("cookbooks"): | |
print "Scanning %s" % cb_dir | |
for cb in os.listdir(cb_dir): | |
if not os.path.isdir(os.path.join(cb_dir, cb)): |
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 argparse | |
import os | |
import git | |
from prettytable import PrettyTable | |
if __name__ == "__main__": | |
p = argparse.ArgumentParser() | |
p.add_argument("base_dir") | |
args = p.parse_args() |
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 zmq | |
import pifacedigitalio | |
import argparse | |
from time import sleep | |
if __name__ == "__main__": | |
p = argparse.ArgumentParser() | |
p.add_argument("input", type=int) | |
p.add_argument("prefix", type=str) | |
p.add_argument("port", type=int) |
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
from subprocess import check_output | |
import argparse | |
import os | |
import re | |
BASE_DIR = os.path.abspath(".") | |
STATUS_LINE_RE = r"^(\w+?)\s+?(\w.+?)\s\((.+?)\)$" | |
if __name__ == "__main__": | |
p = argparse.ArgumentParser() |