Skip to content

Instantly share code, notes, and snippets.

View mgwilliams's full-sized avatar

Matthew Williams mgwilliams

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mgwilliams on github.
  • I am mgwilliams (https://keybase.io/mgwilliams) on keybase.
  • I have a public key whose fingerprint is 82E8 EF07 2EA5 B420 D4DA 019C 5A58 9137 7A58 8E3F

To claim this, I am signing this object:

@mgwilliams
mgwilliams / lxc-agent-forward.sh
Last active September 30, 2020 13:50
example of how to forward ssh-agent into an lxc
#!/bin/bash
# Example Script to forward ssh-agent socket into an unprivileged lxc
# This allows access to the ssh-agent by commands executed with lxc-attach
set -m
CONTAINER=$1 # e.g., test-container
REMOTE=$2 # e.g, user@example.com
@mgwilliams
mgwilliams / kvsqlite.py
Last active August 29, 2015 13:57
SaltmModule to store key/value in sqlite
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# Import python libs
import logging
import codecs
# Import third party libs
try:
import msgpack
import logging
try:
import nacl.state
from nacl.auto import *
from nacl.run import run
HAS_NACL = True
except ImportError:
HAS_NACL = False
# -*- coding: utf-8 -*-
'''
Special CSV outputter for grains ;-)
'''
# Define the module's virtual name
__virtualname__ = 'csv'
def __virtual__():
---
interfaces:
- bond0:
options:
- bond-mode: active-backup
- bond-miimon: 100
- bond-downdelay: 200
- bond-updelay: 100
- bond-slaves: none
- bond-primary: eth0 eth1
@mgwilliams
mgwilliams / hiera.py
Created February 22, 2012 22:07
Python script to access data from hiera...
from subprocess import check_output
import json
import collections
def hiera(key, environment, location, hostname, merge=None, preserve_order=True, bin="/usr/local/bin/hiera", confdir="/etc/puppet/"):
if preserve_order:
obj_pair_hook=collections.OrderedDict
else:
obj_pair_hook=None
d-i partman-auto/expert_recipe string \
multiraid :: \
10000 10 10000 raid \
$primary{ } method{ raid } \
. \
50000 10 50000 raid \
method{ raid } \
. \
10000 10 10000 raid \
method{ raid } \
@defer.inlineCallbacks
def setUp(self):
self.cmanager = ManagedCassandraClientFactory(keyspace='system')
self.client = CassandraClient(self.cmanager)
for i in xrange(CONNS):
reactor.connectTCP(HOST, PORT, self.cmanager)
yield self.cmanager.deferred
self.my_keyspace = KsDef(
name=KEYSPACE,