Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
terrancesnyder / app.js
Last active August 28, 2024 01:55
Google Form Script to Update Dropdown from Sheet
/**
* Main function to run to update our forms.
*/
function main(formID) {
var dropdown = findDropdown_(formID || '1l3Txklywu6AF6jfkzMRPccdzpsOkhHLoOhNol9OwVV4', 'Agreement Group')
dropdown.setChoiceValues(getAgreementGroups_());
}
/**
* Get the latest agreement groups available to select from.
@terrancesnyder
terrancesnyder / lua.yaml
Created August 8, 2024 15:21
JSON encode LUA configmap for istio
apiVersion: v1
kind: ConfigMap
metadata:
annotations:
name: lua-libs
namespace: gateways
data:
JSON.lua: "-- -*- coding: utf-8 -*-\n--\n-- Simple JSON encoding and decoding in
pure Lua.\n--\n-- Copyright 2010-2017 Jeffrey Friedl\n-- http://regex.info/blog/\n--
Latest version: http://regex.info/blog/lua/json\n--\n-- This code is released
@terrancesnyder
terrancesnyder / envoy_workload_id.yaml
Created August 8, 2024 15:20
Enable envoyfilter to inject a common workload id sourced from env, jwt and mtls with a priority of (1) jwt, (2) mtls and (3) env.
kubectl apply -n gateways -f - <<EOF
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: lua-filter-example
spec:
configPatches:
- applyTo: HTTP_FILTER
match:
context: ANY # Adjust if needed for your use case
@terrancesnyder
terrancesnyder / send_email_row.js
Created June 5, 2024 06:30
send_email_on_row_change (Click on Extensions > Apps Script.)
function onEdit(e) {
// Get the range that was edited
var range = e.range;
var sheet = range.getSheet();
// Specify the column that triggers the email (e.g., column 3 is column C)
var triggerColumn = 3;
// Check if the edited column is the one we are interested in
if (range.getColumn() == triggerColumn) {
// Get the row of the edited cell
var row = range.getRow();
@terrancesnyder
terrancesnyder / example_rule.json
Created September 14, 2023 02:59
Example of protecting with Ory Oathkeeper Access to API (GET)
{
"id": "Protect a People API with Consent Check",
"match": {
"url": "http://api.woven-city.io/api/people/contacts",
"methods": [ "GET" ]
},
"upstream": {
"url": "https://my_container_or_dns:8080/api/people/contacts"
},
"authenticators": [{
@terrancesnyder
terrancesnyder / merge_regions.sh
Last active January 31, 2020 02:38
automated merge hbase 0.98+ - Bash script that will invoke hshell to query for regions and then perform a merge_region command but only within each regionserver (to avoid data copy/locality issues)
#!/bin/bash
TABLE=$1
MAX=$2
echo "Examining Table $TABLE...."
echo "scan 'hbase:meta',{ COLUMNS => 'info:server', FILTER=>\"PrefixFilter('$TABLE')\"}" | hbase shell > "$TABLE.out" 2>&1
echo "Making splits $TABLE.splits"
echo "" > "$TABLE.splits"
hadoop fsck / | egrep -v '^\.+$' | grep -v corrup | grep / | grep -oh '^\S*:' | rev | cut -c 2- | rev | sort | uniq > corrupted.flst
@terrancesnyder
terrancesnyder / apiary.txt
Last active August 22, 2019 20:03
API Ary - Draft
[#ftl]
[#-- @ftlvariable name="resourceApis" type="java.util.List<com.webcohesion.enunciate.api.resources.ResourceApi>" --]
[#-- @ftlvariable name="serviceApis" type="java.util.List<com.webcohesion.enunciate.api.services.ServiceApi>" --]
[#-- @ftlvariable name="data" type="java.util.List<com.webcohesion.enunciate.api.datatype.Syntax>" --]
[#-- @ftlvariable name="title" type="java.lang.String" --]
[#-- @ftlvariable name="disableMountpoint" type="java.lang.Boolean" --]
[#-- @ftlvariable name="disableResourceLinks" type="java.lang.Boolean" --]
[#-- @ftlvariable name="apiRelativePath" type="java.lang.String" --]
[#-- @ftlvariable name="includeApplicationPath" type="java.lang.Boolean" --]
@terrancesnyder
terrancesnyder / email-template.html
Created November 13, 2018 03:20
email-template.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Catalina News</title>
</head>
<link href="https://fonts.googleapis.com/css?family=Noto+Sans|Roboto:100,300,400,500" rel="stylesheet">
<style>
body {
margin: 0px auto;
Exception in thread "iothread-2" java.lang.NullPointerException
at zmq.Utils.tuneTcpSocket(Utils.java:48)
at zmq.TcpListener.acceptEvent(TcpListener.java:91)
at zmq.IOObject.acceptEvent(IOObject.java:123)
at zmq.Poller.run(Poller.java:250)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "iothread-2" java.lang.NullPointerException
at zmq.Utils.tuneTcpSocket(Utils.java:48)
at zmq.TcpListener.acceptEvent(TcpListener.java:91)
at zmq.IOObject.acceptEvent(IOObject.java:123)