Skip to content

Instantly share code, notes, and snippets.

View nitrocode's full-sized avatar
🚀
Thinking and typing

RB nitrocode

🚀
Thinking and typing
View GitHub Profile
@nitrocode
nitrocode / install-atom-common-apm-packages.sh
Created October 16, 2017 07:07
My common atom packages for python, node, and web
#!/bin/bash
# list of my favorite atom packages to relieve my pain transitioning to a new computer
# get a full list of apm packages in a single line
# apm list -ib | cut -d@ -f1 | tr '\n' ' '
# web
apm install -y atom-html-preview
# autocomplete
@nitrocode
nitrocode / dead-simple-click-implementation.py
Created March 8, 2018 23:46
A really simple click implementation with groups
#!/usr/bin/env python
# Usage:
# python script.py idk
# python script.py whatever okay
import click
# the main group
@click.group()
def main():
@nitrocode
nitrocode / mailto-english.py
Last active March 14, 2018 22:37
Converts mailto links to english instead of opening them in your non cloud based stock mail client that you never configured
#!/usr/bin/env python
# Sometimes you get a mailto link and it opens up a mail client that you never
# use and on top of that, the mailto url is url encoded so it's full of
# percent characters. Instead of having to decode it manually or put it in a
# website to decode, I decided to write up this solution.
#
# Usage:
# install mailto-english.py /usr/local/bin/mailto-english
# mailto-english "mailto:jobs%40gravitational.com?subject=Application%20for%20DevOps%20Engineer%20at%20Gravitational&body=Hi%21%0A%0AI%27d%20like%20to%20apply%20for%20your%20position%20for%20a%20DevOps%20Engineer%20at%20Gravitational"
@nitrocode
nitrocode / equivalent-domains-password-manager.txt
Last active July 9, 2022 07:13
List of equivalent domains for password managers like Bitwarden, LastPass, KeePass, 1Password, etc
# Comma and new line delimited list of equivalent domains for password managers
# Source: https://meta.stackexchange.com/a/81383/386515
# Stackoverflow
askubuntu.com,
mathoverflow.net,
blogoverflow.com,
serverfault.com,
stackoverflow.com,
stackexchange.com,
@nitrocode
nitrocode / send-emails-using-gmail-api.py
Created April 24, 2018 03:02
Sending emails in gmail in an easy, python3 script
# Modified from https://stackoverflow.com/a/37267330/2965993
# I cannot believe how freaking difficult it is to send an email in gmail... hopefully this will simplify it
import httplib2
import base64
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from apiclient import errors, discovery
from oauth2client import file, client, tools
@nitrocode
nitrocode / get-bucket-policy-pretty-json
Last active April 18, 2019 16:52
S3 get bucket policy and make the json pretty
aws s3api get-bucket-policy --bucket vici-configs \
jq .Policy | \
sed 's/^"\(.*\)"$/\1/' | \
sed 's/\\//g' | \
jq
# jq .Policy will get the Policy key of the json
# 1st sed will remove the first and last quotes
# 2nd sed will remove backslashes
# last jq to prettify the json
@nitrocode
nitrocode / proof
Created May 12, 2018 19:42
Keybase proof
### Keybase proof
I hereby claim:
* I am nitrocode on github.
* I am burritocode (https://keybase.io/burritocode) on keybase.
* I have a public key ASDpGVhdVwRWO6rYBK9GXgnhQKXkzwLkfWT_GbFxhZ-W-Ao
To claim this, I am signing this object:
@nitrocode
nitrocode / loaders.sh
Created May 21, 2018 12:16
Load commands that slow down the terminal like nvm, jenv, pyenv, docker, etc
#!/bin/sh
function loadnvm {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
}
function loadjenv {
eval "$(jenv init -)"
@nitrocode
nitrocode / osx-move-window-back-to-screen.scpt
Created May 30, 2018 14:35
If a window has fallen off the screen, Apple Script can be used to reposition it. In this case, I used the SecurID app.
#!/usr/bin/osascript
tell application "SecurID"
set position to {100, 100}
end tell
@nitrocode
nitrocode / tfatt.function.sh
Created June 15, 2018 02:36
tfa will read the terraform.tfstate file and print out all the attributes of a resource
#!/bin/sh
# Usage: tfa aws_instance.demo
# Depends on jq
# Must be run in a directory where the json terraform.tfstate file exists
function tfa () {
cat terraform.tfstate | jq ".modules[0].resources.\"$1\".primary.attributes";
}