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 / mdate,py
Created February 25, 2022 16:11
mdate - Endless March
#!/usr/bin/env python3
"""Endless March"""
from datetime import datetime
import subprocess
actual_date = subprocess.run("date",capture_output=True, text=True)
actual_date_parts = actual_date.stdout.split()
today = datetime.now()

Change 'master' to 'main' in place from local Github clone

The scenario:

  • You have a local clone of a Github-hosted repo with master as the default branch
  • Optionally, you have the hub command-line tool installed
  • Optionally, you have a Github Personal Access Token that can write to the relevant repos
@knoxilla
knoxilla / git-mstat
Last active October 25, 2021 18:52
Git command to get ahead-behind status for current branch against _all_ remotes, not just origin
#!/usr/bin/env bash
# Get ahead-behind status for current branch against _all_ remotes
# To use, put this executable script anywhere on your PATH
# TODO make git alias instead of a PATH git-<command> executable
BRANCH=$(git branch --show-current)
# Could override branch with argument but let's keep it simple
# BRANCH=${1-${BRANCH}}
@knoxilla
knoxilla / bookmarklet.js
Created August 2, 2021 18:37
Show Alt Text Bookmarklet for Twitter
javascript:(function()%7Bvar a%3Ddocument.createElement(%27style%27),b%3Bdocument.head.appendChild(a)%3Bb%3Da.sheet%3Bb.insertRule(%27a%5Brole%3Dlink%5D div%5Baria-label%5D::after,div%5Baria-label%5D%5Bdata-testid%3DpreviewInterstitial%5D::after%7Bcontent:attr(aria-label)%3Bdisplay:block%3Bbackground-color:rgba(0,0,0,.8)%3Bcolor:%23ff0%3Bfont-family:%5C%27Segoe UI%5C%27,-apple-system,BlinkMacSystemFont,Roboto,Oxygen-Sans,Ubuntu,Cantarell,%5C%27Helvetica Neue%5C%27,sans-serif%3Bpadding:1em%3Bposition:absolute%3Btop:0%3Bleft:0%3Bright:0%3Bz-index:1%7D%27,0)%3Bb.insertRule(%27%5Bdir%3Dauto%5D>svg%7Bdisplay:none%7D%27,0)%3Bb.insertRule(%27a%5Brole%3Dlink%5D div%5Baria-label%5D%7Bdisplay:contents%3Bmargin-top:unset !important%3Bmargin-bottom:unset !important%7D%27,0)%3B%7D)()%3B
// I can't remember where I got this. So helpful! Sorry about lack of attribution. :(
@knoxilla
knoxilla / Makefile
Created June 21, 2018 21:23 — forked from ryu1kn/Makefile
Encrypt/decrypt with AWS KMS using AWS cli
# How to encrypt/decrypt your text/blob secret with AWS KMS with AWS cli
KEY_ID=alias/my-key
SECRET_BLOB_PATH=fileb://my-secret-blob
SECRET_TEXT="my secret text"
ENCRYPTED_SECRET_AS_BLOB=encrypted_secret_blob
DECRYPTED_SECRET_AS_BLOB=decrypted_secret_blob # Result of decrypt-blob target
encrypt-text:
@knoxilla
knoxilla / expected_conditions_example.py
Created April 11, 2018 14:22 — forked from easonhan007/expected_conditions_example.py
python selenium expected_conditions examples
#encoding:utf-8
# example of how to use https://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/support/expected_conditions.py
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
import unittest

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.

Keybase proof

I hereby claim:

  • I am knoxilla on github.
  • I am thomasknox (https://keybase.io/thomasknox) on keybase.
  • I have a public key whose fingerprint is 0D91 30B1 E21B AC8C 4634 D30C B6A6 580E FD35 8A62

To claim this, I am signing this object:

@knoxilla
knoxilla / github label automation notes.md
Last active August 27, 2016 21:43
Github custom label automation

Label Automation

Possible Schema 1

pri: blocker
pri: critical
pri: important
pri: normal
pri: low