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

accessibility

  • autoscroll - add middle click scroll button
  • behindtheoverlay - remove overlayed popups
  • duplicate tab shortcut key
  • go back with backspace
  • one tab - flattens tabs into a single tab with links
  • session buddy - saves one session for shopping, another for work, etc
  • tab to window/popup - keyboard shortcut

apps

#!/bin/sh
filepath=vault/prod/mysql/prod/dbcore-db-read/roles/read_only.sql
diff \
<(git show origin/master:$filepath | tr ' ' '\n') \
<(git show origin/branch-name:$filepath | tr ' ' '\n')
@nitrocode
nitrocode / aws-alb-lambda-terraform.tf
Last active December 21, 2020 20:23
Attempt to create a route on an ALB to be redirected to a Lambda WIP
# local vars
locals {
name = "hello"
env = "dev"
lb_name = join("-", list("TF", local.env, local.name))
zip_path = "${local.name}.zip"
tags = {
env = local.env
}
}
@nitrocode
nitrocode / CEgetExtension.lua
Last active December 30, 2018 20:11
Download lua extensions for cheatengine programatically from a url
-- source: https://stackoverflow.com/a/40195356
--- Check if a file or directory exists in this path
function exists(file)
local ok, err, code = os.rename(file, file)
if not ok then
if code == 13 then
-- Permission denied, but it exists
return true
end
end
@nitrocode
nitrocode / verify_slack_request.py
Last active March 1, 2025 11:46
Verify slack requests for slash commands in python3
#!/usr/bin/env python3
import hashlib
import hmac
import base64
def verify_slack_request(event: dict, slack_signing_secret: str) -> bool:
"""Verify slack requests.
Borrowed from https://janikarhunen.fi/verify-slack-requests-in-aws-lambda-and-python.html
@nitrocode
nitrocode / get-tag-value-of-ec2-on-ec2.sh
Created March 1, 2019 08:03
Get the tag value of an EC2 on-the-fly using sh on the EC2 itself
#!/bin/sh
REGION=us-east-1
INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
function tag() {
aws ec2 describe-tags --region "$1" \
--filters "Name=resource-id,Values=$2" \
--query 'Tags[?!contains(Key, `:`)].[Key,Value]' | \
jq -r "map( {(.[0]): .[1]} ) | add | .$3"
@nitrocode
nitrocode / aws-get-bucket-policy-readable-json.sh
Created June 5, 2019 20:13
Get the aws bucket policy in human readable json
#!/bin/sh
aws s3api get-bucket-policy --bucket site-region-config-dev | jq -r .Policy | jq
@nitrocode
nitrocode / aws-get-Name-tag-private-ip-ec2.sh
Created July 3, 2019 19:22
aws-get-Name-tag-private-ip-ec2.sh
#!/bin/sh
# source: https://stackoverflow.com/a/43532465/2965993
function aws-get-name() {
aws ec2 describe-instances \
--filters "Name=network-interface.addresses.private-ip-address,Values=$2" | \
jq '.Reservations[].Instances[].Tags[] | select(.Key=="Name").Value'
}
aws-get-name "10.10.10.10"
# use aws-get-name from https://gist.github.com/nitrocode/41924629833615efc1ab34945727732f
# get /32 cidr ips using ripgrep
ips=`rg '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/32' -ttf -o -I --no-line-number | sort -u`
# TODO: below
for ip in $ips; do
# convert each ip to human readable name using the Name tag of the IP and append to an array
$name=`aws-get-name $ip`
@nitrocode
nitrocode / secure_anon_ssh_keys.md
Last active October 18, 2019 16:46
Create secure anonymous ssh keys