Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
# Recently I had to send a password to someone over Skype. Since that's obviously not a good idea, I asked for | |
# the person's public SSH RSA key, and used it to encrypt the password itself. | |
# Convert the public key into PEM format | |
ssh-keygen -f path/to/id_rsa.pub -e -m pem > ~/id_rsa.pub.pem | |
# Using the public pem file to encrypt a string | |
echo "sometext" | openssl rsautl -encrypt -pubin -inkey ~/id_rsa.pub.pem > ~/encrypted.txt |
We sometimes experience a node(s) running hot. Determining what to do is conditional on the rest of the cluster. If it’s one node out of 50 that’s running hot, we can chalk it up too “bad node” and kill it. However, if it’s >50% of the nodes running hot, we should seek to understand what’s happening within the service. To that end, I wanted to create an alert on outlier nodes.
Let’s start with cumulative idle on a host:
sum without(cpu, job) (irate(node_cpu{host=~"prod-foo.*",mode="idle"}[3m]))
Idle is the measure of unused CPU, so it’s a shortcut for matching mode !~ "idle". Should we care, we’d want to subtract this from 1 to get the consumed CPU. Also of note, we accumulating idle from all CPUs on the host, and not averaging per cpu.
Now, let’s get the average idle for the cluster:
Host * | |
PermitLocalCommand yes | |
StrictHostKeyChecking ask | |
Host github.com | |
HostName github.com | |
User git | |
IdentitiesOnly yes | |
Match Host github.com exec "pwd | grep '/Workspace' > /dev/null" |
This is a good article for how to get multiple accounts, with differing ssh keys, to work with github: https://medium.com/@xiaolishen/use-multiple-ssh-keys-for-different-github-accounts-on-the-same-computer-7d7103ca8693
I started with this, but this scheme means I can't just cut-paste the repo link from browser to command line; I'd have to rewrite the host every time I want to use the second key. Example:
# This will always pick up my main ssh key
git clone [email protected]:Hefeweizen/junk.git