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 json | |
| import os | |
| import argparse | |
| PLUGIN_EXTENSIONS = ("hpi", "jpi") | |
| def plugin_name(path): | |
| file_name = os.path.basename(path) |
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
| (umask 077; openssl rsa -in private.key.secure -out private.key -passin pass:yourpassword) |
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 socket | |
| import argparse | |
| if __name__ == "__main__": | |
| p = argparse.ArgumentParser() | |
| p.add_argument("port", type=int) | |
| args = p.parse_args() | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
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
| knife exec -E "nodes.transform('name:ss-virtualserver03') {|n| n.normal_attrs[:vccs_v3][:override_settings].delete(:merge) rescue nil}" |
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
| mkenv() { | |
| mkvirtualenv $(basename $(pwd)) | |
| } | |
| wkon() { | |
| workon $(basename $(pwd)) | |
| } | |
| rmenv() { | |
| rmvirtualenv $(basename $(pwd)) |
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() |
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
| 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 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
| 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 |