Skip to content

Instantly share code, notes, and snippets.

View ahamilton55's full-sized avatar

Andrew Hamilton ahamilton55

  • Los Angeles, CA
View GitHub Profile
@ahamilton55
ahamilton55 / ubuntu_ldap_auth.sh
Created April 5, 2012 17:18
Ubuntu Client Auth over LDAP
#!/bin/bash
# Set environment vars for a silent install through apt-get
export DEBIAN_FRONTEND=noninteractive
export DEBIAN_PRIORITY=critical
# Install the LDAP utilities
apt-get -y install libpam-ldap libnss-ldap nss-updatedb libnss-db
# Reset environment vars for apt-get
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"github.com/ahamilton55/zapier-test/mcchunker"
"github.com/bradfitz/gomemcache/memcache"

Keybase proof

I hereby claim:

  • I am ahamilton55 on github.
  • I am ahamilton55 (https://keybase.io/ahamilton55) on keybase.
  • I have a public key whose fingerprint is 4C1C 3B1B FC03 28CF AB6E 0C5F B1AD 06D5 1B37 85DD

To claim this, I am signing this object:

@ahamilton55
ahamilton55 / gist:4075198
Created November 14, 2012 22:10
Add the current account name and user to the BASH prompt
parse_euca_user() {
if [[ ! -z ${EC2_USER_ID} ]]; then
if [[ ! -e ${HOME}/.my_ec2_user_id || $(cat ${HOME}/.my_ec2_user_id | cut -d' ' -f1) -ne ${EC2_USER_ID} ]]; then
EC2_ACCOUNT_NAME=$(euare-accountlist | grep $EC2_USER_ID | cut -d' ' -f1)
EC2_USER_NAME=$(basename $EC2_CERT | cut -d'-' -f2)
echo ${EC2_USER_ID} ${EC2_ACCOUNT_NAME} >${HOME}/.my_ec2_user_id
else
EC2_ACCOUNT_NAME=$(cat $HOME/.my_ec2_user_id | cut -d' ' -f2)
EC2_USER_NAME=$(basename $EC2_CERT | cut -d'-' -f2)
fi
@ahamilton55
ahamilton55 / gist:4075118
Created November 14, 2012 21:57
Add the current account name to a BASH prompt
parse_euca_user() {
if [[ ! -z ${EC2_USER_ID} ]]; then
if [[ ! -e ${HOME}/.my_ec2_user_id || $(cat ${HOME}/.my_ec2_user_id | cut -d' ' -f1) -ne ${EC2_USER_ID} ]]; then
EC2_ACCOUNT_NAME=$(euare-accountlist | grep $EC2_USER_ID | cut -d' ' -f1)
echo ${EC2_USER_ID} ${EC2_ACCOUNT_NAME} >${HOME}/.my_ec2_user_id
else
EC2_ACCOUNT_NAME=$(cat $HOME/.my_ec2_user_id | cut -d' ' -f2)
fi
fi
echo ${EC2_ACCOUNT_NAME}
@ahamilton55
ahamilton55 / euca2ools_pkgbuild
Created July 11, 2012 05:46
PKGBUILD for euca2ools 2.1 on Arch Linux
# Contributors:
# henning mueller <henning@orgizm.net>
# Andrew Hamilton <andrew.hamilton@eucalyptus.com>
pkgname=euca2ools
pkgver=2.1.0
pkgrel=1
pkgdesc='Command-line tools for interacting with Amazon EC2 and S3 API-compatible Web services using the REST/Query API.'
arch=(any)
url=http://www.eucalyptus.com/
@ahamilton55
ahamilton55 / Output
Created June 24, 2015 22:09
Templating vars
$ ansible-playbook -i deploy_conf/localhost -vvv -e group=test test.yml
1 plays in test.yml
PLAY: ***************************************************************************
TASK [debug msg={{ my_var }}] ***************************************************
fatal: [localhost]: FAILED! => {"msg": "ERROR! the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'my_var' is undefined", "failed": true}
NO MORE HOSTS LEFT **************************************************************
± % ansible-playbook -i deploy_conf/localhost test.yml
PLAY: ***************************************************************************
TASK [setup] ********************************************************************
ok: [localhost]
TASK [debug msg=Hello] **********************************************************
fatal: [localhost]: FAILED! => {"failed": true, "stdout": ""}
---
- hosts: localhost
connection: local
vars:
my_var: {"something": "{{ truth3 }}" }
tasks:
- debug: msg="Hello"
when: truth4 is not defined and my_var is defined
---
- hosts: test
gather_facts: no
tasks:
- name: Pause for a test
local_action: pause seconds=4