Skip to content

Instantly share code, notes, and snippets.

@simonmcc
simonmcc / gist:1376887
Created November 18, 2011 16:09
attach/create screen session on login
#
# Only run ssh stuff if this is a login shell..
if [ ! -z "$PS1" -a ! -z "$SSH_TTY" ]
then
# This is where the ssh-agent environment settings
# are pulled in from
~/bin/ssh-agent-env
echo > /dev/null
if [ "$TERM" != "screen" ]
@simonmcc
simonmcc / gist:1387040
Created November 22, 2011 21:30
puppet execcreates
define execcreates( $creates, $cwd )
{
$command = $name
exec { "$command":
creates => $creates,
cwd => $cwd,
}
file { "$creates":
@simonmcc
simonmcc / route53DynDNS.bash
Created July 22, 2012 21:06
Amazon Route 53 Dynamic DNS Updater Script
#!/bin/bash
#
# This script requires xpath to parse part of the dnscurl.pl output
# on CentOS/RedHat/Amazon Linux:
#
# sudo yum install perl-XML-XPath
#
# also, dnscurl.pl (from http://aws.amazon.com/code/Amazon-Route-53/9706686376855511)
# expects your secrets to be in ~/.aws-secrets
# using a file format like this (from http://dmz.us/wp/wp-content/uploads/r53/aws-secrets.txt)
@simonmcc
simonmcc / gist:4050331
Created November 10, 2012 07:46
puppet localuser define
define user::localuser ( $email, $uid, $password, $key_type, $key = 'missing') {
$username = $title
# Create the user. This is where most of the magic happens.
user { $username:
comment => $email,
home => "/home/${username}",
shell => '/bin/bash',
password=> $password,
16:07:02: handleConnectivityForAccount: <ESIRCAccount:3178ea0 3>:simonmcc_freenode reachable: 1
16:07:02: <ESIRCAccount:3178ea0 3>:simonmcc_freenode: Original image of size 128.000000 128.000000
16:07:02: -[CBPurpleAccount setAccountUserImage:withData:]:2717: <ESIRCAccount:3178ea0 3>:simonmcc_freenode: Setting icon data of length 0
16:07:02: <ESIRCAccount:3178ea0 3>:simonmcc_freenode: Updating status for key: User Icon
16:07:02: Adium: Connect: simonmcc_freenode initiating connection using status state <AIStatus: 4eebfb0 [Available]> ((null)).
16:07:02: Setting status on fb75d90 (simonmcc_freenode@irc.ircrelay.com): ID available, isActive 1, attributes {
}
16:07:02: (Libpurple: account) Connecting to account simonmcc_freenode@irc.ircrelay.com.
16:07:02: (Libpurple: connection) Connecting. gc = 0x11ac09660
@simonmcc
simonmcc / gist:4435825
Created January 2, 2013 16:26
If I set the account details, and leave the Personal details blank (http://note.io/12YgNVM & http://note.io/X0GgJJ), I get a quicker disconnect:
16:14:47: -[AIAccount(Abstract) retrievePasswordThenConnect]:448: Retrieving <ESIRCAccount:3178ea0 3>:simonmcc_freenode's password (promptOption 2)
16:14:47: handleConnectivityForAccount: <ESIRCAccount:3178ea0 3>:simonmcc_freenode reachable: 1
16:14:47: Created PurpleAccount 0xfb1bb20 with UID simonmcc_freenode and protocolPlugin prpl-irc
16:14:47: Created PurpleAccount 0xfb1bb20 with UID simonmcc_freenode, protocolPlugin prpl-irc
16:14:47: <ESIRCAccount:3178ea0 3>:simonmcc_freenode: Original image of size 128.000000 128.000000
16:14:47: -[CBPurpleAccount setAccountUserImage:withData:]:2717: <ESIRCAccount:3178ea0 3>:simonmcc_freenode: Setting icon data of length 0
16:14:47: <ESIRCAccount:3178ea0 3>:simonmcc_freenode: Updating status for key: User Icon
16:14:47: Adium: Connect: simonmcc_freenode initiating connection using status state <AIStatus: 4eebfb0 [Available]> ((null)).
16:14:47: Setting status on fb1bb20 (simonmcc_freenode@irc.ircrelay.com): ID available, isActive 1, attributes {
@simonmcc
simonmcc / gist:4437509
Last active December 10, 2015 12:58
moniker PPA - missing dependency? (python-pyparsing)
Setting up python-moniker (0.0.235.b5ecff2-7) ...
Setting up moniker-common (0.0.235.b5ecff2-7) ...
Adding system user `moniker' (UID 108) ...
Adding new user `moniker' (UID 108) with group `moniker' ...
Not creating home directory `/var/lib/moniker'.
Setting up moniker-central (0.0.235.b5ecff2-7) ...
moniker-central start/running, process 22273
Creating config file /etc/moniker/moniker-central.conf with new version
@simonmcc
simonmcc / gist:4443087
Created January 3, 2013 12:21
file not File & file
#
# Manage the skel directory.
#
file { '/etc/skel/':
source => 'puppet:///modules/users/etc/skel',
ensure => directory,
recurse => true,
purge => true,
force => true,
diff --git a/designate/schema.py b/designate/schema.py
index f813a30..c1c1907 100644
--- a/designate/schema.py
+++ b/designate/schema.py
@@ -109,6 +109,14 @@ class SchemaValidator(jsonschema.Draft3Validator):
if instance == '0.0.0.0': # RFC5735
msg = "%s is not an IPv4 address" % (instance)
yield jsonschema.ValidationError(msg)
+ # is it a dotted quad & all 4 fields <= 255
+ m = re.match('(\d+)\.(\d+)\.(\d+)\.(\d+)$', instance)
#!/bin/bash
#
# Upload that bloody cookbook, even if knife thinks it's not a cookbook
#
abspath () {
case "$1" in
/*)printf "%s\n" "$1";;
*)printf "%s\n" "$PWD/$1";;
esac
}