Skip to content

Instantly share code, notes, and snippets.

View thealanberman's full-sized avatar
🍸
learning

Alan Berman thealanberman

🍸
learning
  • SF Bay Area
View GitHub Profile
@thealanberman
thealanberman / Chili.md
Last active November 8, 2022 06:18
Chili

Ingredients:

  • 1 pounds lean ground beef
  • 1 (15 ounce) can tomato sauce
  • 1 (14.5 ounce) can diced tomatoes
  • 2 (15 ounce) cans kidney beans, drained and rinsed
  • 1 (15 ounce) can pinto beans, drained and rinsed
  • 1 chopped onion
  • 1 chopped green bell pepper
  • 1/4 teaspoon ground cayenne pepper
  • 1/2 teaspoon white sugar
@thealanberman
thealanberman / slice-of-life-slackbot.gs
Created August 9, 2022 20:05
Slice of Life slackbot. Prompts twice a day for everyone in the channel to post a picture.
// INSTRUCTIONS
// Set the Incoming webhook URL in the Script Properties key-value store
// give it the key name "slack_url"
// Set a time-based Trigger of the 'DelayedTrigger' function. Have it trigger at 0800 in the desired timezone
// The script will post 2 messages:
// One between between 8am and 3pm
// The other between 3pm and 10pm
@thealanberman
thealanberman / slice-of-life.gs
Created July 22, 2022 04:26
Google App Script to send a "post a pic" message twice a day
// Randomized posting of 2 messages
// One between between 8am and 3pm
// The other between 3pm and 10pm
function DelayedTrigger() {
// for readability
var minutes = 60 * 1000
// There are 840 minutes between 8am and 10pm
var morningDelay = randomInteger(1,420)
@thealanberman
thealanberman / mac_recommendations.md
Last active August 8, 2023 16:25
My Mac Recommendations

macOS Recommendations

General Utilities

  • Rectangle — a free option for window snapping/arrangement stuff.
  • AltTab — an improved window switcher with some decent customizability
  • Shifty — a macOS "night shift" slider
  • Raycast — Spotlight replacement, somewhat like Alfred, but free and more customizable
  • Better Touch Tool — not free, but worth every penny. Pretty awesome window snapping/arrangement capabilties (like Rectangle but MOAR), and lets you create shortcuts for keyboard/mouse/touchpad/touchbar/etc.
  • Keka — compression utility that handles 7zip, rar, and some other archive formats that don't work natively in macOS.
  • NameChanger — batch file-renamer with a handy intuitive UI
@thealanberman
thealanberman / code.gs
Last active October 16, 2024 15:52
Simple Mattermost Bot via Google Apps Script and Outgoing Webhook
/*************
MATTERMOST OUTGOING WEBHOOK BOT
INSTRUCTIONS
Create a Google Spreadsheet
In column A of Sheet1, put a list of however many potential responses you'd like.
@thealanberman
thealanberman / bash_retries_with_timeout.sh
Created August 7, 2019 13:47
Bash retry with timeout
# Lifted from https://stackoverflow.com/a/12321815
# Adjust command and retries as needed
NEXT_WAIT_TIME=0
RETRIES=5
until command || [[ "${NEXT_WAIT_TIME}" == "${RETRIES}" ]]; do
sleep $(( NEXT_WAIT_TIME++ ))
done
@thealanberman
thealanberman / self_help.sh
Created March 17, 2019 06:33
Self documenting Bash script
#!/usr/bin/env bash
if [[ ${*} =~ help|-h || ${#} == 0 ]]; then cat <<HELP_USAGE | sed "s/^#? //"
#? USAGE
#? ======
#? Anywhere in your script:
#?
#? if [[ $* =~ help|-h || $# == 0 ]]; then cat <<HELP_USAGE | sed "s/^#? //"
#? #? Documentation lines prefixed with '#? '
#? HELP_USAGE
@thealanberman
thealanberman / ffmpeg_audio_split.sh
Last active August 7, 2019 13:50
Helps split a full album audio file into individual tracks with FFmpeg
#!/usr/bin/env bash
# set -euxo pipefail # uncomment this for debugging
###################################
# INSTRUCTIONS
# 1. Set Artist, Album, Timestamps and Track Names below
# 2. Save split.sh into the folder with file to be split
# 3. ./split.sh <m4a file to be split>
###################################
@thealanberman
thealanberman / mattermost-bulk-emoji-uploader.sh
Created September 7, 2018 07:05
Bulk Emoji Uploader for Mattermost 5.x (v4 api)
#!/usr/bin/env bash
if [[ -d "${1}" ]]; then
dir="${1}"
else
echo "USAGE: $(basename "${0}") /path/to/emoji/folder"
exit
fi
read -r -p "Server Hostname: " MMSERVER
@thealanberman
thealanberman / Keto Goodies Blueberry Muffin Recipe.md
Created August 18, 2018 19:55
Keto Goodies Blueberry Muffin Recipe

Keto Goodies Blueberry Muffin Recipe

Yields 12 muffins

Ingredients

  • 3 cups almond flour
  • 1/2 cup natural sweetener (we use a blend of erythritol and oligosaccharides)
  • 4 oz sour cream
  • 4 large eggs