Skip to content

Instantly share code, notes, and snippets.

Avatar
🍸
learning

Alan Berman thealanberman

🍸
learning
  • SF Bay Area
View GitHub Profile
View slack-slash-echo.js
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;
View BingoCardGenerator.gs
// 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 Oct 5, 2017
Amazon — focus on search box on page load. Jump to search box via '/' key. Unfocus with Esc key. https://userscripts-mirror.org/
View Amazon Search Tweaks Userscript
// ==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
View keybase.md

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:

View Instant Pot Butter Chicken.md

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
View Keto Goodies Blueberry Muffin Recipe.md

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 Sep 7, 2018
Bulk Emoji Uploader for Mattermost 5.x (v4 api)
View mattermost-bulk-emoji-uploader.sh
#!/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 Aug 7, 2019
Helps split a full album audio file into individual tracks with FFmpeg
View ffmpeg_audio_split.sh
#!/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 Mar 17, 2019
Self documenting Bash script
View self_help.sh
#!/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
View bash_retries_with_timeout.sh
# 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