Skip to content

Instantly share code, notes, and snippets.

View knoxilla's full-sized avatar
🤔
Well That's Fun!

Thomas Knox knoxilla

🤔
Well That's Fun!
View GitHub Profile
@knoxilla
knoxilla / aws-resource-exists.bash
Last active September 23, 2020 21:20
Useful AWS bash function - resource_exists() - for pre-checking and avoiding collisions
#!/bin/bash
# written and explained by others!
# https://blogs.aws.amazon.com/cli/post/Tx93V7O09I96SO/AWS-re-Invent-2015-and-more
# https://github.com/awslabs/awscli-reinvent2015-examples/blob/master/scripts/setup-dev-ec2-instance
# Note: you need "jp" installed
# to run this command. You can
# brew tap jmespath/jmespath && brew install jp
# to install on a Mac.
@knoxilla
knoxilla / humanize_sqlplus.md
Last active January 21, 2021 18:50
How to make sqlplus more pleasant with rlwrap and a nice prompt

Humanizing sqlplus

It's always been frustrating to me that sqlplus does not have REPL behavior, so you can't arrow-up through your history, etc. In addition, the default SQL prompt is not very informative. Since I often work on prod and dev databases at the same time, it is important to me that I know where I am when I am executing disastrous SQL.

Well, rlwrap to the rescue! Plus, a handy login.sql script to customize your sqlplus prompt. The package was available by default in RHEL6 and on OSX El Capitan. YMMV...

Three Parts

You'll need to do three small things, and you are good to go,

@knoxilla
knoxilla / gitconfig-and-you.md
Last active September 25, 2023 14:31
'git' is not a git-command. See 'git --help'.

Make git do stuff

Let's get some help from the shell.

$ cat >> ~/.bash_aliases
alias get = 'git'
alias gi = 'git'
alias got = 'git'
alias gti = 'git'
"""How many pizzas do we need?"""
import math
import sys
if len(sys.argv) > 1:
people = int(sys.argv[1])
else:
people = int(raw_input("How many RSVPs? "))