Skip to content

Instantly share code, notes, and snippets.

View jakebrinkmann's full-sized avatar

Jake Brinkmann jakebrinkmann

View GitHub Profile
@jakebrinkmann
jakebrinkmann / .flake8
Last active April 22, 2024 13:42
Using the Python poetry tool to manage dependencies of an AWS Serverless (AWS-SAM-CLI) project.
##### https://flake8.pycqa.org/en/latest/user/configuration.html
[flake8]
ignore =
# D100: Missing docstring at top of file
D100,
# D104: Missing docstring in __init__.py
D104,
# D401: Docstring first line should be imperative
D401,
# D101 Missing docstring in public class
@jakebrinkmann
jakebrinkmann / aws-proxy.sh
Last active November 12, 2021 16:01
AWS SSM Bastion Proxy to SSH into EC2 instance inside VPC (so I can port-tunnel to my database)
#!/usr/bin/env sh
######## Dependencies ##########################################################
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html
# https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
#
######## Usage #################################################################
#
# Install Proxy Command
# - Move this script to ~/.ssh/aws-proxy.sh
@jakebrinkmann
jakebrinkmann / fix_usb.sh
Last active September 9, 2021 17:15
Linux always messes up my USB drives! WTF! ROKU! WINDOWS??
YOUR_FLASH_DRIVE=$(/bin/ls /dev/disk/by-id/usb-*\:0)
sudo fdisk $YOUR_FLASH_DRIVE
# o <CR> n <CR> p <CR> <CR> <CR> <CR> w <CR>
sudo mkfs.fat $YOUR_FLASH_DRIVE-part1
sudo chmod -R ugo+rw $YOUR_FLASH_DRIVE
eject $YOUR_FLASH_DRIVE
@jakebrinkmann
jakebrinkmann / README.md
Last active October 20, 2022 20:15
mypy and py2puml to create UML diagrams from Python Type Annotations

py2puml-mypy-rnd

pip install plantuml
pip install py2puml
pip install mypy
mypy .
@jakebrinkmann
jakebrinkmann / graph1.gv
Last active June 17, 2021 18:44
graphviz dot png diagram
/*
http://www.graphviz.org/doc/info/lang.html
*/
digraph G {
size ="10,10"; // Comment
ranksep=.75;
main [label="MAIN\n<AWS::IAM::Role>"];
main -> parse -> execute;
main -> init;
main -> cleanup;
@jakebrinkmann
jakebrinkmann / pomo.sh
Created June 3, 2021 17:33
taskwarrior (task management, pomodoro)
# Some default values
DEFAULTPOMODOROS="6"
WORKTIME="1500" # in seconds (25 minutes)
SHORTREST="300" # in seconds (5 minutes)
LONGREST="1200" # in seconds (20 minutes)
LONGBREAK="4" # number of pomodoros before a long break
UPDATEINTERVAL="60" # in seconds
# Function to provide the updates for the progress bar
# Parameter 1 = time in seconds
@jakebrinkmann
jakebrinkmann / DailyTimesheet.xml
Last active September 26, 2021 22:09
Windows 10 Task Scheduler - Tell myself to go home or take a lunch break by LockWorkStation (XML)
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2021-09-26T17:04:07.1303814</Date>
<Author>jbrinkma</Author>
<URI>\Daily Timesheet</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2021-09-26T16:45:00</StartBoundary>
@jakebrinkmann
jakebrinkmann / MyRow.test.js
Last active April 13, 2021 18:40
Jest Testing (Node.js, React-Testing-Library (RTL), CLI Inspect)
import React from 'react';
// https://redux.js.org/recipes/writing-tests
import { render, fireEvent, screen } from '../../../test-utils.js';
import MyRow from './MyRow.js';
describe('test for MyRow', () => {
it('renders a row allowing delete', () => {
const { getByText, getByTitle } = render(
<MyRow key={0} canEdit={true} id={0} />,
@jakebrinkmann
jakebrinkmann / example-plpgsql-subject-under-test.sql
Last active July 20, 2021 03:22
Database (DB) unit testing in pure SQL (postgresql, plpgsql)
create [or replace] function foo_func(param_list)
[ RETURNS rettype
| RETURNS TABLE ( column_name column_type [, ...] ) ]
language plpgsql
as
$BODY$
<<first_block>> -- declare ... begin ... end
declare
-- variable declaration
film_count integer := 0;
@jakebrinkmann
jakebrinkmann / verify-domain.sh
Created March 18, 2021 15:47
Automation scripts to verify identities (email/domain/mail-from) in AWS SES
#!/usr/bin/env bash
# Verify the domain so we can send email from 'no-reply@${1}'
HOSTEDZONENAME=${1:-jakebrinkmann.xyz}
HOSTEDZONEID=$(aws route53 list-hosted-zones-by-name --dns-name $HOSTEDZONENAME | jq -r .HostedZones[0].Id)
TXTTOKEN=$(aws ses verify-domain-identity --domain $HOSTEDZONENAME | jq -r .VerificationToken)
aws ses 'set-identity-mail-from-domain' --identity $HOSTEDZONENAME --mail-from-domain "no-reply.$HOSTEDZONENAME" --behavior-on-mx-failure UseDefaultValue