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
func textualUtf8Resolver(textual []byte) ([]byte, error) { | |
var t map[string]interface{} | |
_ = json.Unmarshal(textual, &t) | |
response, err := json.Marshal(t) | |
if err != nil { | |
return nil, err | |
} | |
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
machines=($(docker-machine ls | sed '1d' | awk '{print $1}')) | |
for i in "${machines[@]}" | |
do | |
: | |
docker-machine ssh $i sudo docker login -u XXXXXXX -p XXXXXXXXXXXXXXX [REGISTRY]; | |
docker-machine ssh $i sudo docker pull [REGISTRY]/[IMAGE]:latest & | |
done |
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 | |
# relaunch with sudo if we aren't root | |
if [[ $EUID -ne 0 ]]; then | |
echo "$0: relaunching as sudo $0 $1 $USER" | |
sudo "$0" $1 $USER | |
exit $? | |
fi | |
real_user=$USER |
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/sh | |
PARAMETERS=`aws ssm get-parameters-by-path --path ${1} --with-decryption` | |
for row in $(echo ${PARAMETERS} | jq -c '.Parameters' | jq -c '.[]'); do | |
KEY=$(basename $(echo ${row} | jq -c '.Name')) | |
VALUE=$(echo ${row} | jq -c '.Value') | |
KEY=`echo ${KEY} | tr -d '"'` | |
VALUE=`echo ${VALUE} | tr -d '"'` |
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
git filter-branch --index-filter 'git rm --cached --ignore-unmatch blah.jar' -f --tag-name-filter cat -- --all | |
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch folder/' -f --tag-name-filter cat -- --all |
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
curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz | |
tar xvfz pip-1.2.1.tar.gz | |
cd pip-1.2.1 | |
zypper install python-setuptools | |
python setup.py install | |
ln -sfn /usr/local/bin/pip /usr/bin/pip | |
pip install --upgrade awscli | |
cd .. |
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 'mechanize' | |
require 'open-uri' | |
require 'rubygems' | |
require 'work_queue' | |
wq = WorkQueue.new 1000 | |
(1..5000).each do |number| | |
#beginning = Time.now | |
wq.enqueue_b do |
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 ruby | |
require 'net/smtp' | |
unless (2..3).include? ARGV.length | |
puts 'Usage: mail.rb SUBJECT TO [FROM]' | |
exit 1 | |
end | |
subject, to, from_ = ARGV |
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
# | |
# Sets Prezto options. | |
# | |
# Authors: | |
# Sorin Ionescu <sorin.ionescu@gmail.com> | |
# | |
# | |
# General | |
# |
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
def humanize secs | |
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name| | |
if secs > 0 | |
secs, n = secs.divmod(count) | |
"#{n.to_i} #{name}" | |
end | |
}.compact.reverse.join(' ') | |
end | |
p humanize 1234 |
NewerOlder