This file contains hidden or 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
getInside() { | |
# pass in a container ID | |
CONTID=$1; | |
# This prints out export commands you can paste into the terminal once inside the container - not always needed | |
sudo docker inspect $CONTID | awk '/(PATTERN FOR ENV VARIABLES YOU CARE ABOUT)/ { gsub(/[",]/,"",$1); print "export " $1 } ' | |
# Get the process ID | |
PID=$(sudo docker inspect --format {{.State.Pid}} $CONTID ); | |
# Status message | |
echo "Entering container $CONTID with PID $PID"; | |
# Enter the container |
This file contains hidden or 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 | |
curl -s "http://localhost:9200/_cluster/state?pretty=true&filter_metadata=true&filter_indices=true&filter_routing_table=true" |
This file contains hidden or 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 | |
#### either replace $USERNAME, $DOCKERHOST and $IMAGENAME in the command | |
#### or adjust and use the following export commands before running this as a script | |
# export USERNAME=xcsrz | |
# export DOCKERHOST=1.1.1.1 | |
# export IMAGENAME=xcsrz/forth | |
ssh $USERNAME@$DOCKERHOST "sudo docker save $IMAGENAME | gzip -c" | gunzip -c | docker load |
This file contains hidden or 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/ruby | |
$url = ARGV[0] | |
$rounds = ARGV[1] || 10 | |
loadTimes = [] | |
puts "fetching page #{$rounds} times ..." | |
$rounds.to_i.times do | |
print "." | |
loadTimes << (`curl -w '%{time_total}\n' -o /dev/null -s "#{$url}"`).to_f |
This file contains hidden or 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
while [[ `docker ps -a -q | wc -l` -gt `docker ps -q | wc -l` ]]; do docker rm ` docker ps -a -q | head -n 25`; done |
This file contains hidden or 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/ruby | |
require 'optparse' | |
envs = [] | |
roles = [] | |
user = ENV['XKNIFE_SSH_USER'] || nil | |
debug = false | |
if ENV['XKNIFE_CHEF_REPO'] |
This file contains hidden or 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
/^([0-9a-f]){8}(-([0-9a-f]){4}){4}([0-9a-f]){8}$/i |
This file contains hidden or 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 "json" | |
state = JSON.parse `curl localhost:9200/_cluster/state` | |
dets = {} | |
state["nodes"].each do |name, details| | |
dets[name] = { "name" => details["name"], "address" => details["transport_address"] } | |
end |
This file contains hidden or 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
ruby -e 'require "securerandom"; print SecureRandom.uuid;' |
This file contains hidden or 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
SET global general_log = 1; | |
SET global log_output = 'table'; | |
-- and then | |
select * from mysql.general_log order by event_time desc |
OlderNewer