Skip to content

Instantly share code, notes, and snippets.

@EntropyWorks
EntropyWorks / keybase.md
Created April 16, 2018 02:46
keybase.md

Keybase proof

I hereby claim:

  • I am entropyworks on github.
  • I am entropyworks (https://keybase.io/entropyworks) on keybase.
  • I have a public key ASBEizwP9cMSt_Cng03KzF4GnkgiLVpfr4x48Vdb_RM0UAo

To claim this, I am signing this object:

@EntropyWorks
EntropyWorks / amifind.sh
Created January 16, 2018 19:54 — forked from vancluever/amifind.sh
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter)
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \
@EntropyWorks
EntropyWorks / timestamp.sh
Created November 22, 2017 18:25
Timestamp output
# Not originally created by me btw.
# Handy python timestamp trick
function p-timestamp() {
python -c 'import sys,time;sys.stdout.write("".join\
(( " ".join((time.strftime("[%Y-%m-%d %H:%M:%S]", time.localtime())\
, line)) for line in sys.stdin )))'
}
## Custom echo that adds a timestamp
function echo() {
@EntropyWorks
EntropyWorks / aws-swap
Last active January 10, 2018 11:49
Do you have multiple AWS profiles that you need to swap between?
#!/bin/bash
#
# Do you have multiple AWS profiles?
# Here is how I deal with them.
#
# Make sure you add "${HOME}/.bash_aws_profile" to your .bashrc or .bash_profile so
# all new terminal sessions are updated with your choice.
#
aws-swap(){
unset AWS_DEFAULT_PROFILE
@EntropyWorks
EntropyWorks / webserver.go
Created August 8, 2017 02:13 — forked from alexisrobert/webserver.go
Tiny web server in Go for sharing a folder
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010-2014 Alexis ROBERT <[email protected]>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import "net/http"
import "net/url"
@EntropyWorks
EntropyWorks / sshpass.rb
Created June 4, 2017 20:21 — forked from M-Barnett/sshpass.rb
brew install sshpass
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
sha256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@EntropyWorks
EntropyWorks / .bash_gpg-agent
Created March 15, 2017 21:41
Using gpg-agent instead of ssh-agent
GPG_TTY=$(tty)
export GPG_TTY
if test -f "$HOME/.gpg-agent-info" && \
kill -0 "$(grep GPG_AGENT_INFO "$HOME/.gpg-agent-info" | cut -d: -f 2)" 2>/dev/null; then
. "${HOME}/.gpg-agent-info"
echo "first . ${HOME}/.gpg-agent-info"
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
@EntropyWorks
EntropyWorks / add-ssh-keys.yml
Last active March 29, 2022 21:04
Add all the hosts from your ansible inventory to your .ssh/known_hosts and also use ssh-copy-id to add keys to the hosts
---
# Original idea found at http://stackoverflow.com/a/39083724
#
# ansible -i inventory.ini add-ssh-keys.yml
#
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
@EntropyWorks
EntropyWorks / create-brew-restore.sh
Last active November 12, 2018 22:41
Backing up my brew install
#!/bin/bash
# Pipe the output to create your own restore-brew.sh
#
brew_command=/usr/local/bin/brew
echo '#!/usr/bin/env ANSIBLE_HOSTS="" ANSIBLE_CONNECTION=local ansible-playbook'
echo '# vim:ft=yaml'
echo ''
echo '---'
echo "- name: Homebrew Restore from $(date)"