Skip to content

Instantly share code, notes, and snippets.

View dhbradshaw's full-sized avatar

Douglas H. Bradshaw dhbradshaw

  • Harvest Alabama
View GitHub Profile

Boiled Eggs

  • Place eggs into bottom of sauce pan.
  • Cover eggs with water.
  • Bring to boil.
  • Allow to boil for 4 minutes.
  • Turn off burner and allow to cool.
  • Eat at will.
@dhbradshaw
dhbradshaw / safe--git-branch-delete.sh
Created February 28, 2022 15:45
Delete all redundant git branches
# Delete all redundant git branches
# 1. `git branch` lists all the branches
# 2. `xargs -L1` consumes the pipe output one line at a time, feeding it as an an arg to the target command
# 3. `git branch -d` deletes the branches that are redundant (already merged).
# Note: this print results for each branch, either
# saying it's deleted or that you need to use -D to delete it because it's not redundant.
git branch | xargs -L1 git branch -d
@dhbradshaw
dhbradshaw / validate_xlsx_xml.md
Created November 10, 2021 12:39
Validate all the xml from an Excel xlsx file

Validate Excel .xlsx file xml using linux

Unzip

A .xlsx file is roughly a zipped bundle of xml files. To unzip them, just use unzip.

Here we send the unzipped contents of myfile.xlsx to the myfile_unzipped directory, which will be created on the fly.

unzip myfile.xlsx -d myfile_unzipped
@dhbradshaw
dhbradshaw / gist:13d0ea29e4a4cea1b74c9903ed24d957
Last active October 29, 2021 10:09
Flutter .zshrc for Mac
export PATH="$PATH:/Users/doug/projects/flutter/bin" # Point to your downloaded flutter executable
# export CHROME_EXECUTABLE=/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser # Point to your chromium executable
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('my-bucket-name')
bucket.object_versions.filter(Prefix='my/key/prefix').delete()
@dhbradshaw
dhbradshaw / next_image.sh
Created April 25, 2021 02:50
Command to rotate to the next image on gnome desktop (if I save images I want to rotate through to Pictures/rotate_background)
#!/bin/bash
DIR="/home/doug/Pictures/rotate_background"
# Get full path
FULL_PATH=$(gsettings get org.gnome.desktop.background picture-uri)
# Clean off quotes.
FULL_PATH=$(echo $FULL_PATH | sed 's/.$//' | sed 's/^.//')
@dhbradshaw
dhbradshaw / reviewable_bindings.json
Last active November 2, 2020 18:40
Reviewable Key Bindings
[
["f", "Show next/latest diffs", "setProposedDiffBounds()"],
["n", "Next unreviewed file", "nextUnreviewedFile()"],
["p", "Previous unreviewed file", "prevUnreviewedFile()"],
[null, "Next personally unreviewed file", "nextPersonallyUnreviewedFile()"],
[null, "Previous personally unreviewed file", "prevPersonallyUnreviewedFile()"],
["shift+n", "Next changed file", "nextChangedFile()"],
["shift+p", "Previous changed file", "prevChangedFile()"],
[null, "Next visible file", "nextVisibleFile()"],
@dhbradshaw
dhbradshaw / save-heroku-config-vars-to-env.sh
Created May 13, 2020 16:31 — forked from tibawatanabe/save-heroku-config-vars-to-env.sh
Command line to save Heroku config vars into .env file
heroku config | sed 's/: */=/g; /^=/d' >> .env
@dhbradshaw
dhbradshaw / pagerDutyResolver.md
Created February 10, 2020 14:28
PagerDuty Resolver Bot

Resolving my pagerduty problems with a simple js script

No user deletions for you!

Recently I had to delete a user from pagerduty, but the interface blocked me from doing so, saying that I couldn't complete the deletion until all of that users issues were resolved.

Slog ahead

I looked at the unresolved issues and there were thousands.

@dhbradshaw
dhbradshaw / rust_setup.md
Created December 5, 2019 12:43
Rust setup

Rust setup

More often than one might expect, I find myself setting up a new environment for rust development.
Here are some things that I end up doing repeatedly.

Summary

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install cargo-watch

sudo apt install libpq-dev
cargo install diesel_cli --no-default-features --features postgres