Skip to content

Instantly share code, notes, and snippets.

View kelseyhightower's full-sized avatar

Kelsey Hightower kelseyhightower

View GitHub Profile
#!/bin/bash
declare -r NEW_SITE_IP="162.209.67.97"
declare -r OLD_SITE_IP="96.126.112.51"
declare -r HOST_FILE="/etc/hosts"
declare -r SITE=$1
function report_current_site() {
grep -q "" $HOST_FILE
if [ $? != 0 ]; then
#!/bin/bash
function clear_audit_logs() {
/bin/cat /dev/null > /var/log/audit.log
/bin/cat /dev/null > /var/log/wtmp
}
function remove_ssh_host_keys() {
/bin/rm -f /etc/ssh/*key*
}
@kelseyhightower
kelseyhightower / go compiler flags
Created July 10, 2013 13:26
What is that compiler up to.
go build -gcflags=-S hello.go
# command-line-arguments
--- prog list "main" ---
0000 (/Users/kelseyhightower/hello.go:5) TEXT main+0(SB),$48-0
0001 (/Users/kelseyhightower/hello.go:5) LOCALS ,$0
0002 (/Users/kelseyhightower/hello.go:6) MOVQ os.Stdout+0(SB),SI
0003 (/Users/kelseyhightower/hello.go:6) MOVQ SI,(SP)
0004 (/Users/kelseyhightower/hello.go:6) LEAQ go.string."Hello, World\n"+0(SB),SI
0005 (/Users/kelseyhightower/hello.go:6) LEAQ 8(SP),BP
@kelseyhightower
kelseyhightower / gist:6191348
Last active July 5, 2018 05:20
go.crypto/ssh example
package main
import (
"bytes"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"
"crypto"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
package main
import (
"fmt"
"log"
"os"
"syscall"
"time"
)
@kelseyhightower
kelseyhightower / time.go
Created August 25, 2013 00:19
time to string
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
---
- hosts: nginx
tasks:
- add_host: name={{ host }} groups=nginx
roles:
- nginx
$ ansible-playbook playbooks/nginx.yml -e "host=192.168.12.131" --list-hosts
playbook: playbooks/nginx.yml
play #1 (nginx): host count=0
$ ansible-playbook playbooks/nginx.yml -e "host=192.168.12.131" --list-hosts
playbook: playbooks/nginx.yml
play #1 (localhost): host count=0
play #2 (nginx): host count=0
$ ansible-playbook playbooks/nginx.yml -e "host=192.168.12.131"
PLAY [localhost] **************************************************************
skipping: no hosts matched
PLAY [nginx] ******************************************************************
skipping: no hosts matched
PLAY RECAP ********************************************************************