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 sys | |
from django.conf.urls import url | |
from django.core.wsgi import get_wsgi_application | |
from django.http import HttpResponse | |
from django.conf import settings | |
settings.configure( | |
DEBUG='on', | |
ROOT_URLCONF=__name__, | |
) |
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
my-ec2-config: | |
id: GKTADJGHEIQSXMKKRBJ08H | |
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs | |
keyname: default | |
private_key: /root/default.pem | |
provider: ec2 | |
# full file here : http://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.ec2.html | |
# if any of the vars is missing, you'll get | |
# [WARNING ] The cloud driver, 'ec2', configured under the 'my-ec2-config' cloud provider alias was not loaded since 'ec2.get_configured_provider()' could not be found. Removing it from the available providers list |
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 pint | |
import functools | |
import itertools | |
ureg = pint.UnitRegistry() | |
def require_args(*args): | |
units = args |
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
# pip install pytoml pyaml | |
import pytoml | |
import yaml | |
import json | |
# no ConfigParser here | |
testdict={'copterz': 'lol', | |
'nest': {'this': 'that'}, | |
'nestnest': {'hive': { 'bees' : 3, 'ants' : -1} , 'house' : 'frogs' }, | |
'mah' : ['dogs','catz'], |
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 logging | |
import pip | |
log = logging.getLogger(__name__) | |
def check_package(package): | |
requirement = pip.req.InstallRequirement.from_line(package) |
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 html5lib | |
import requests | |
def get_packages(): | |
page = 'https://python3wos.appspot.com/' | |
doc = html5lib.parse(requests.get(page).content, | |
namespaceHTMLElements=False) | |
table = doc.find('body/div/div/table/tbody') | |
if not table: |
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
{%- set fqdn = grains['id'] %} | |
{%- set internal_ip = grains['ip4_interfaces']['eth0'][0] %} | |
hostname-match: | |
file.managed: | |
- name: /etc/hostname | |
- contents: {{ fqdn }} | |
primary_ip_in_host_file: | |
host.present: |
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
# OSX for Hackers (Mavericks/Yosemite) | |
# | |
# Source: https://gist.github.com/brandonb927/3195465 | |
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront |
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 argparse | |
import collections | |
import yaml | |
import librato | |
# ht to http://stackoverflow.com/a/16782282/295231 | |
# http://stackoverflow.com/a/20720773/295231 | |
class UnsortableList(list): | |
def sort(self, *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
// excellent solution from here : http://stackoverflow.com/a/24028231/295231 | |
//macro glue to make it work on msvc/gcc | |
#define GLUE(x, y) x y | |
#define RETURN_ARG_COUNT(_1_, _2_, _3_, _4_, _5_, count, ...) count | |
#define EXPAND_ARGS(args) RETURN_ARG_COUNT args | |
#define COUNT_ARGS_MAX5(...) EXPAND_ARGS((__VA_ARGS__, 5, 4, 3, 2, 1, 0)) |
OlderNewer