Skip to content

Instantly share code, notes, and snippets.

View djmitche's full-sized avatar

Dustin J. Mitchell djmitche

View GitHub Profile
@djmitche
djmitche / signin-aws
Last active July 28, 2021 18:44 — forked from jonasfj/signin-aws
A simple script for forcing 2FA usage with AWS credentials
#!/bin/bash
# This script expects AWS credentials:
# SIGNIN_AWS_ACCESS_KEY_ID
# SIGNIN_AWS_SECRET_ACCESS_KEY
# Or it will use the credentials set up with `aws configure` if those are not set.
#
# It optionally epects the TOTP entry name in your yubikey
# SIGNIN_AWS_YUBIKEY_OATH_NAME
# Put these environment variables into your .bashrc.local (or .bashrc, if you
import os,ctypes,struct,errno,sys
CLONE_NEWIPC = 0x08000000
CLONE_NEWUSER = 0x10000000
CLONE_NEWNET = 0x40000000
start_uid = os.getuid()
start_gid = os.getgid()
c = ctypes.CDLL("libc.so.6", use_errno = True)
@djmitche
djmitche / class.py
Created September 21, 2012 15:13 — forked from tomprince/class.py
class MyRenderable(object):
def getRenderingFor(self, props):
return someStuff
properties.render(MyRenderable())
@djmitche
djmitche / gist:3189746
Created July 27, 2012 18:48 — forked from glarizza/gist:3185860
User Declaration for OS X 10.7 and 10.8
$password_data = $macosx_productversion_major ? {
'10.7' => { password => 'aaa6c1f945132d2599079fe90c9d20e608e607344b86328c1ef8ad8dc820c1bb5a31fd816b8ae546fed6dcf58ff023794f8250a66935d6d0687b737f24aae2ed' },
'10.8' => {
password => '0590ade19e6953c135ae872ae77618235df7d46c63de7f9a0fcdf2cd9e7d85e4b7ca868101235b6158e05a309805ee4814b027a4be9c23ec2926bc8172269affba5c9a5985e81091fa6898076d297f1faa75fa617551ef1671d7520055c4a0d97b9b9c5805aa322baedbcd8ee9c523811653ac2ea9e9c8d8f1ac519a0f2b595e',
salt => 'somesalthere',
iterations => '12390',
}
}
user { 'test':
@djmitche
djmitche / gist:1849429
Created February 17, 2012 01:04 — forked from oremj/gist:289961
def config():
name = 'fxfeeds'
port = 50000
ip = '63.245.209.124'
public_port = '443'
print """\
probe tcp %(name)s-probe
port %(port)s
interval 3
ok 7 - empty read from zero-length buffer
Breakpoint 2, zcloud_memory_upload_producer (buffer=0x804e070,
buffer_length=43) at memory_upload_producer.c:121
121 return ret;
(gdb) p *ret
$2 = {parent = {parent = {g_type_instance = {g_class = 0x8056458},
ref_count = 1, qdata = 0x0}},
buffer = 0x804e070 "The quick brown fox jumps over the lazy dog",
buffer_length = 43, buffer_position = 0}
<para>
Amanda automatically creates a bucket when writing, if the bucket doesn't
already exist. At that time, it specifies where Amazon should store the data
based on the S3_BUCKET_LOCATION property. Currently, there are two valid settings:
"*" (any location, probably US) and "EU" (Europe). If this property is not set,
Amazon's default value of "*" is used. The bucket location has both billing and legal concerns, so you are encouraged to consult Amazon's documentation for details.
</para>
<para>
Amazon does not permit changes to bucket locations, so this is a permanent
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
name = Chris AtLee
email = catlee@mozilla.com
[remote "origin"]
url = git://github.com/djmitche/buildbot/
@djmitche
djmitche / git-prompt.sh
Created January 15, 2009 16:59 — forked from henrik/.bashrc
edit existing PS1; be more efficient
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir [master] $ # clean working directory
# username@Machine ~/dev/dir [master*] $ # dirty working directory
# djmitche: *edit* an existing PS1 to add the git information
# djmitche: only invoke 'git' and 'sed' once (each) for each prompt
# djmitche: display [NO BRANCH] when not on a branch (e.g., during rebase -i)
# djmitche: almost completely replace with __git_ps1 from git contrib, which
# gives more information and avoids calling git scripts if possible