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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"strings" | |
) | |
func getdir(str string) (string, string) { |
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
# Print decoded kubernetes secrets | |
# kubectl secrets nameofsecret -o json | kubernetes_raw_secrets.sh | |
tmp=$(mktemp) | |
cat > $tmp | |
keys=$(cat $tmp| jq -ra '.data | to_entries[] | .key') | |
for key in $keys; do | |
value=$(cat $tmp | jq -r '.data."'$key'"' | base64 -d) | |
echo "$key: $value" | |
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 | |
# Connect to ec2 instances using either InstanceId, Name tag or Ip address | |
# Usage: | |
# - ec2ssh i-123124123123 | |
# - ec2ssh [-n 2] name_tag | |
# - ec2ssh IP | |
username=core |
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
# Make short hostname only if its not an IP address | |
__tm_get_hostname(){ | |
local HOST="$(echo $* | rev | cut -d ' ' -f 1 | rev)" | |
if echo $HOST | grep -P "^([0-9]+\.){3}[0-9]+" -q; then | |
echo $HOST | |
else | |
echo $HOST| cut -d . -f 1 | |
fi | |
} |
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 BaseHTTPServer | |
import socket | |
import fcntl | |
import struct | |
address = '0.0.0.0' | |
port = 12345 | |
interface = 'eth0' |
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
# dockshell container [command] # Runs bash (or command) in container specified by name | |
dockshell(){ | |
default='bash' | |
if [ $# -gt 0 ]; then | |
cmd=${2:-$default} | |
C_ID=$(sudo docker ps | awk '{if ( $2 == "'$1'") print $1}') | |
sudo docker exec -it $C_ID $cmd | |
else | |
echo "ERROR. Need container name" | |
fi |
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
" Write eyaml encrypted pass directly | |
" http://github.com/javipolo | |
" | |
function! Eyaml_input() | |
call inputsave() | |
let my_pass = input('Secret: ') | |
call inputrestore() | |
let encpass = system("eyaml encrypt -o string -q -s ".shellescape(my_pass)." 2>/dev/null") | |
call append(line('.'), split(encpass, '\v\n')) | |
join |