This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for { | |
func() { | |
defer func() { | |
if r := recover(); r != nil { | |
fmt.Printf("panic: %v\n", r) | |
} | |
}() | |
// CODE here | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
connection: local | |
tasks: | |
- shell: exit 1 | |
register: task_result | |
until: task_result.rc == 0 | |
retries: 10 | |
delay: 1 | |
ignore_errors: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
od -x /dev/urandom | head -1 | awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OS="$(uname -s)" | |
case $OS in | |
"Darwin") | |
echo dar | |
;; | |
"Linux") | |
echo lin | |
;; | |
*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import sys | |
import random | |
interrupts = {} | |
count = int(sys.argv[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wait_tcp_port() { | |
local host="$1" port="$2" | |
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax. | |
while ! exec 6<>/dev/tcp/$host/$port; do | |
echo "$(date) - still trying to connect to $host:$port" | |
sleep 1 | |
done | |
exec 6>&- | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import binascii | |
s = 'MDAxMDAwMDEwMTExMDEwMTAxMTAxMTExMDExMTEwMDEwMDEwMDAwMDAxMTEwMTAwMDExMDExMTAwMTEwMDAwMTAxMTEwMTExMDAxMDAwMDAwMTEwMDEwMTAxMDEwMTEx' | |
binary = int(base64.b64decode(s), 2) | |
ascii = binascii.unhexlify('%x' % binary) | |
print ascii[::-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mixlib/cli' | |
require "chef" | |
require "chef/config" | |
require "chef/config_fetcher" | |
require 'chef/workstation_config_loader' | |
class MyCLI | |
include Mixlib::CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import requests | |
import os | |
import boto.ec2 | |
import sys | |
import re | |
build_url = os.environ['BUILD_URL'] | |
jenkins_base_url = os.environ['JENKINS_URL'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
awk 'BEGIN{ser=strftime("%Y%m%d",systime() )*100+1} /serial/{sub($1,$1 < ser ? ser : $1+1)}1' $1 |
NewerOlder