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
module['exports'] = function echo(hook) {
// hook.io has a range of node modules available - see
// https://hook.io/modules.
// We use request (https://www.npmjs.com/package/request) for an easy way to
// make the HTTP request.
var request = require('request');
// The parameters passed in via the slash command POST request.
var params = hook.params;
@thealanberman
thealanberman / BingoCardGenerator.gs
Last active August 18, 2017 20:35
BingoCardGenerator
// the ID for the spreadsheet of quotes
var sheet_id = SpreadsheetApp.getActiveSpreadsheet().getId();
var sheet = SpreadsheetApp.openById(sheet_id);
var range = sheet.getDataRange();
var values = range.getValues();
var rows = range.getNumRows();
// Log some things for sanity check
Logger.log("sheet ID: " + sheet_id)
Logger.log("sheet: " + sheet)
@thealanberman
thealanberman / Amazon Search Tweaks Userscript
Last active October 5, 2017 07:37
Amazon — focus on search box on page load. Jump to search box via '/' key. Unfocus with Esc key. https://userscripts-mirror.org/
// ==UserScript==
// @name Amazon Search Tweaks
// @namespace https://gist.github.com/thealanberman/e8b902b8b19636a7c4b08afb93c46140
// @description Focus on search box on page load. Jump to search box via '/' key. Unfocus with Esc key.
// @include http://amazon.*/
// @include https://amazon.*/
// @include http://*.amazon.*/
// @include https://*.amazon.*/
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @version 1

Keybase proof

I hereby claim:

  • I am thealanberman on github.
  • I am thealanberman (https://keybase.io/thealanberman) on keybase.
  • I have a public key ASC4BO9SHRufBgjW79nTKO1Vfcdob8aadx2GcBADT9-p-go

To claim this, I am signing this object:

@thealanberman
thealanberman / Instant Pot Butter Chicken.md
Last active August 17, 2018 20:23
Instant Pot Butter Chicken

Instant Pot Butter Chicken

Serves four.

Ingredients

  • 1 (14-ounce) can diced tomatoes (do not drain)
  • 1 tablespoon minced garlic
  • 1 tablespoon minced ginger
  • 1 teaspoon ground turmeric
@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
@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 / 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 / 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 / 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