All code is available in example app - https://github.com/maxivak/webpacker-rails-example-app
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
-- Settings | |
set mfaSecret to "<token>" | |
-- Install oath-toolkit if not available | |
try | |
do shell script "which /usr/local/bin/oathtool" | |
on error | |
display dialog "This script needs to install oath-toolkit. Please ensure that brew is installed, then hit OK to continue." | |
do shell script "brew install oath-toolkit" | |
end try |
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
kubectl -n $namespace get secret $name -o json | jq -r '.data | map_values(@base64d)' |
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
import os | |
import time | |
import re | |
import subprocess | |
from watchdog.observers import Observer | |
from watchdog.events import FileSystemEventHandler | |
def get_relative_path(path): | |
return os.path.relpath(path) |
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
package main | |
import ( | |
"log" | |
"os/exec" | |
) | |
func main() { | |
path, err := exec.LookPath("ls") | |
if err != nil { |
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
// Package sqlmap provides functions for querying directly into | |
// map[string]interface{}. | |
// | |
// In developing really simple api endpoints, I found the boilerplate needed | |
// to take the results of a database query and output them as JSON to be | |
// really fucking annoying; make a custom struct, scan into that struct, if | |
// there are multiple rows do the whole rows.Next() song and dance, and if | |
// anything changes update the three spots each column of the result is now | |
// dependent on. Even when using libraries like sqlx, there's still a lot of | |
// extraneous code that needs to be written. |
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
kubectl -n $namespace get secret $name -o json | jq -r '.data | map_values(@base64d)' |
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
package mux | |
import ( | |
"net/http" | |
"strings" | |
"golang.org/x/net/http2" | |
"golang.org/x/net/http2/h2c" | |
) |
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
# Send a metric to statsd from bash | |
# | |
# Useful for: | |
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/) | |
# init scripts | |
# sending metrics via crontab one-liners | |
# sprinkling in existing bash scripts. | |
# | |
# netcat options: | |
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed. |
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 | |
VENV=$1 | |
if [ -z $VENV ]; then | |
echo "usage: runinenv [virtualenv_path] CMDS" | |
exit 1 | |
fi | |
. ${VENV}/bin/activate | |
shift 1 | |
echo "Executing $@ in ${VENV}" | |
exec "$@" |
NewerOlder