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 bash | |
hash docker &>/dev/null; | |
if [ $? -eq 0 ]; then | |
alias d="docker" | |
function docker-rm-untagged-imgs() { | |
[[ $1 == "force" ]] && OPTS="--force" || OPTS=""; | |
docker images | grep "^<none>" | awk '{print "docker rmi '$OPTS' "$3}' | sh | |
} |
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 unittest | |
from unittest.mock import patch, call | |
class MyQueue(object): | |
def send(self, message): | |
pass | |
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
from functools import wraps | |
def my_decorator(f): | |
@wraps(f) | |
def wrapper(*args, **kwds): | |
print('Calling decorated function') | |
return f(*args, **kwds) | |
return wrapper |
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 queue | |
from threading import Thread | |
class Worker(Thread): | |
def __init__(self, q, other_arg, *args, **kwargs): | |
self.q = q | |
self.other_arg = other_arg | |
super().__init__(*args, **kwargs) |
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 time | |
from queue import Queue | |
from threading import Thread | |
def threaded(f, daemon=False): | |
def wrapped_f(q, *args, **kwargs): | |
"""this function calls the decorated function and puts the | |
result in a queue""" |
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 random | |
import time | |
from queue import Queue | |
from threading import Thread | |
WORKERS = 2 | |
class Worker(Thread): |
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/local/bin/bash | |
if [ -f /etc/os-release ]; then | |
# freedesktop.org and systemd | |
. /etc/os-release | |
OS=$NAME | |
VER=$VERSION_ID | |
elif type lsb_release >/dev/null 2>&1; then | |
# linuxbase.org | |
OS=$(lsb_release -si) |
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
from StringIO import StringIO | |
from flask import Flask, render_template, send_file | |
app = Flask(__name__) | |
@app.route('/bootstrap') | |
def bootstrap(): | |
str_io = StringIO() |
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 bash | |
# clone the minions branch of the allsalt repo | |
git clone -b minions [email protected]:intuitivetechnologygroup/allsalt.git | |
# build the containers | |
cd allsalt | |
make build-debian | |
make build-centos-minion | |
make build-ubuntu-minion |
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
""" | |
example sls: | |
merge_reactor_config: | |
module.run: | |
- name: conf_manip.merge | |
- origin: /etc/salt/master.d/reactor.conf | |
- source: /srv/salt/mystate/files/reactor.conf | |
""" | |
import filecmp |
NewerOlder