This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function fail { | |
printf '%s\n' "$1" >&2 ## Send message to stderr. | |
exit "${2-1}" ## Return a code specified by $2, or 1 by default. | |
} | |
projectId="" | |
bucket="" | |
dataset="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# iterm2 has some tools that you can install. imgcat displays images on the command line. | |
# this command will flexibly choose the specific cat cmd to run based on the extension. | |
# you can add this to your ~/.profile or whichever other file you've configured for your shell. | |
# run iterm shell integration for each shell. See utilities here: https://iterm2.com/documentation-utilities.html | |
source ~/.iterm2_shell_integration.bash | |
# run different cat cmds based on extension. If img then run imgcat (which is installed with iterm2_shell_integration | |
function cat() { | |
fullfile="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ffmpeg_ext() { ffmpeg -i "$1" "${1%.*}.$2"; } # ffmpeg_ext a.mp4 gif | |
function img_ext() { convert "$1" "${1%.*}.$2"; } # img_ext a.png jpeg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# go directly into a directory containing a file or directory with a matching pattern. | |
# use cdf to match a file, use cdd to match a dir | |
# e.g. | |
# cdd mydir # will match files of the type .*myfile.* | |
# cdd myd.subd # will match like .*myd.*subd.* | |
# cdd myd.subd$ # will match like .*myd.*subd$ | |
# cdf myfile # will match files of the type .*myfile.* | |
# cdf myfile.txt$ # will match files of the type .*myfile.txt$ | |
# go into dir with a specific file in the subdirectory. Uses regex and substitues . with .* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# open matching application on MacOS based on part of the pattern | |
# case insensitive | |
# errors out if there is less than or more than a single match | |
# app is forwarded all parameters after pattern | |
# example usage: a gimp pic.jpeg | |
function a() { | |
local app="$1" | |
# if no dir is specified, then it is the current dir. | |
if [ -z "$app" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# i had a specific requirement to convert icons at iconmonstr.com to all google colors for my slides for youtube.com/AwesomeGCP | |
# doing it manually on their site was cumbersome. | |
# so it is very specific to simple svgs | |
endSvgRgx="\.svg$" | |
# for each input file | |
for file in $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @OnlyCurrentDoc | |
*/ | |
/** | |
* Create a open translate menu item. | |
* @param {Event} event The open event. | |
*/ | |
function onOpen(event) { | |
SlidesApp.getUi().createAddonMenu() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://play.golang.org/p/eBOqfC0V59N - web.go | |
https://play.golang.org/p/kmZms7FoWss - web_test.go | |
https://play.golang.org/p/zVDTSq7jCP6 - web_http_test.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage | |
# cdr a1.b1 | |
# ... this matches all dirs .*a1.*b1.* | |
# cdr ^a1.b1$ | |
# ... this matches all dirs ^./a1.*b1$ | |
# go into dir with a specific file in the subdirectory. Uses regex and substitues . with .* | |
function cfr() { | |
pat=$1 | |
#replace . with .* - so we can give multiple parts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sometimes windows people don't have curl. | |
// This is a simple way to post a curl POST request. | |
// On newer windows versions, you can also try ... | |
// Invoke-WebRequest -Body '{"Author":"A", "Title":"B"}' -Method 'POST' -Uri 'http://localhost:8090/books' | |
package main | |
import ( | |
"fmt" |
NewerOlder