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 | |
from __future__ import print_function | |
import commands | |
import os | |
import stat | |
from gitlab import Gitlab | |
def get_clone_commands(token, repo_root): | |
con = Gitlab("http://gitlab.your.domain", token) |
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
➜ repo git:(master) ✗ sudo cat /etc/systemd/system/docker.service | |
[Unit] | |
Description=Docker Application Container Engine | |
Documentation=https://docs.docker.com | |
After=network.target docker.socket | |
Requires=docker.socket | |
[Service] | |
Type=notify | |
ExecStart=/usr/bin/docker daemon --bip=172.17.0.1/16 -H fd:// |
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
➜ ~ git:(master) ✗ diff -C3 /usr/lib/systemd/system/docker.service /etc/systemd/system/docker.service | |
*** /usr/lib/systemd/system/docker.service 2016-02-12 00:53:30.000000000 +0100 | |
--- /etc/systemd/system/docker.service 2016-02-14 21:48:19.992194898 +0100 | |
*************** | |
*** 6,13 **** | |
[Service] | |
Type=notify | |
! ExecStart=/usr/bin/docker daemon -H fd:// | |
MountFlags=slave |
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
# Keeps a cache directory from growing over a given size limit. | |
# | |
# There are two modes to manage the cache folder: | |
# 1) absolute size limit of the cache folder (--size flag); | |
# 2) keep percentage free space on filesystem (--percent_free flag) | |
import asyncore | |
from collections import OrderedDict | |
import os | |
import sys |
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 boto.dynamodb2 | |
def get_connection(): | |
con = boto.dynamodb2.connect_to_region("eu-west-1") | |
return con | |
def get_new_version(con, package_name): | |
item = con.update_item( |
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 boto import sns | |
from boto.ec2 import cloudwatch | |
MY_TOPIC = "AWSBill" | |
sns_con = sns.connect_to_region("us-east-1") | |
sns_topic = [v.values()[0] for v in sns_con.get_all_topics()["ListTopicsResponse"]["ListTopicsResult"]["Topics"] if v.values()[0].endswith(":" + MY_TOPIC)][0] | |
cw_con = cloudwatch.connect_to_region("us-east-1") |
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/sh | |
rm -rf /var/lib/cloud/sem/* /var/lib/cloud/instance /var/lib/cloud/instances/* | |
cloud-init start 2>&1 > /dev/null | |
cloud-init-cfg all final |
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
service salt-minion stop | |
rm -f /etc/salt/pki/minion/minion_master.pub | |
echo "master: salt" > /etc/salt/minion | |
service salt-minion start |
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
{% for environment in 'prod', 'devel' %} | |
{% if environment == 'prod' %} | |
base: | |
{% else: %} | |
{{environment}}: | |
{% endif %} | |
'G@roles:offlinemaps and G@environment:{{environment}}': | |
- match: compound | |
- cron |
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 API: | |
... def __init__(self): | |
... pass | |
... | |
>>> for i in range(10): | |
... name = "print_number_%i" % i | |
... def print_func(self): | |
... print "my result is", i | |
... setattr(API, name, print_func) | |
... |