Skip to content

Instantly share code, notes, and snippets.

View ahamilton55's full-sized avatar

Andrew Hamilton ahamilton55

  • Los Angeles, CA
View GitHub Profile
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 / 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
@ahamilton55
ahamilton55 / gist:2d2a207e6c1e477386f9
Created July 31, 2014 22:20
Working creates with spaces
---
- name: Test
hosts: localhost
connection: local
vars:
my_file: '/Users/andrew/blah blah.txt'
tasks:
- name: Testing creation
command: /Users/andrew/blah.sh creates="{{ my_file }}"
@ahamilton55
ahamilton55 / gist:e00f3d2b9a8b5858aad0
Created July 8, 2014 05:22
Basic Static Go Web Server
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/foo", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Basic Web Page")
@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}