At Gruntwork, we work with multiple software teams. That means we have to modify the "Switch Role" history multiple times. But the only way to do that today is to delete your cookie and clear all AWS Console saved settings. That got old after a while, so these instructions enable you to modify the "Switch Roles" configuration directly.
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
In the spirit of python's json.tool, provide a command line | |
utility to pretty print XML. | |
Usage (): | |
$ echo "<book><title>Oliver Twist</title></book>" | python -m xmltool | |
<?xml version="1.0" encoding="utf-8"?> |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
# Note: ~/.ssh/environment should not be used, as it | |
# already has a different purpose in SSH. | |
env=~/.ssh/agent.env | |
# Note: Don't bother checking SSH_AGENT_PID. It's not used | |
# by SSH itself, and it might even be incorrect | |
# (for example, when using agent-forwarding over SSH). | |
agent_is_running() { |
# Create using kubectl: | |
# $ kubectl create -f splunk-daemonset.yaml | |
# | |
# You should also add config on your indexer to deal with the json formatted files: | |
# https://answers.splunk.com/answers/148307/how-to-parse-and-extract-json-log-files-in-splunk.html | |
# | |
apiVersion: extensions/v1beta1 | |
kind: DaemonSet | |
metadata: | |
name: splunk-forwarder |
javascript: void | |
function() { | |
var url = location.search; | |
if (url) { | |
var each = url.slice(1).split("&"); | |
console.log("Stripping query parameters:", each); | |
var leave = each.filter(function(url) { | |
return "utm_" !== url.substr(0, 4) && | |
"mc_" !== url.substr(0, 3) && | |
"ct" !== url.substr(0, 2) && |
#!/bin/bash | |
TMP=`mktemp` | |
trap ctrlC INT | |
removeTempFiles() { | |
rm -f $TMP | |
} | |
ctrlC() { |
#!/bin/bash | |
# By B Shea Dec2018 & Mar2020 | |
# https://www.holylinux.net | |
# Test for OpenSSL - if not installed stop here. | |
if ! [[ -x $(which openssl) ]]; then | |
printf "\nOpenSSL not found or not executable.\nPlease install OpenSSL before proceeding.\n\n" | |
exit 1 | |
fi |
Sometimes you want to run a bit more than just one command over ssh, and you also want to maintain interactivity to the processes that you launch. Usually you could just do
ssh -t <host> "foo; bar; fish; paste"
however that can quickly become unwieldly, especialy if it is more than just a sequence of commands. You also can't use
cat my_script | ssh <host> /bin/bash
because then you loose your stdin
and thus your interactivity.
However, there is a way to achieve our goal using the first form above. Consider that the maximum command line length is usually more than 2MB (see getconf ARG_MAX
). Thus, we convert our entire script into a base64 encoded string with cat my_script | base64
and then call
ssh -t <host> /bin/bash "<(echo <base64 string> | base64 --decode)"
.
In this way the entire script is sent to the host in the command buffer, and so long as our total command length is less than 2MB, it will run.
#!/bin/bash | |
RED="\e[31m" | |
GREEN="\e[32m" | |
BOLD="\e[1m" | |
ITALIC="\e[3m" | |
UNDERLINE="\e[4m" | |
END="\e[0m" | |
function usage { |