Skip to content

Instantly share code, notes, and snippets.

View russellsimpkins's full-sized avatar

Russell Simpkins russellsimpkins

View GitHub Profile
/**
* This is based off of another gist I found but I honestly don't recall where. That script was old
* and didn't work with updates to the API. I'm confident that will happen to this script in the future.
* This script will populate a spreadsheet with your meetings. Start by opening a Google spreadsheet and
* then go into App Scripts. You can copy paste this into there and then start making edits. The primary
* function to run is ProcessThisWeek. Have fun.
*
* BEGIN CONFIGS
*/
// Calendar to Search access. You can get this from "Settings & Sharing" page in calendar.
@russellsimpkins
russellsimpkins / gpg-solution.sh
Created December 30, 2020 17:35
gpg solution to keep a secret file encrypted
#!/bin/bash
# pw
# author: "Russell Simpkins"<russellsimpkins@gmail.com>
# this function executes the following:
# 1: copies the encrypted file from the Cloud drive
# 2: decrypts the file
# 3: opens the file in emacs
# 4: cleans up the ~ file emacs creates when you edit
# 5: calls pwc to encrypt the file
function pw() {
@russellsimpkins
russellsimpkins / Camel.go
Created December 29, 2020 20:19
fix deprecation dependency in github.com/infobloxopen/protoc-gen-gorm
modified: gorm/converter.go
modified: gorm/fields.go
modified: gorm/utilities.go
--- a/gorm/converter.go
+++ b/gorm/converter.go
@@ -8,7 +8,7 @@ import (
"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
@russellsimpkins
russellsimpkins / plugin.go
Created December 29, 2020 20:17
github.com/infobloxopen/protoc-gen-gorm fix to remove warning about embedded lock
index 21c5b4a..18ad64b 100644
--- a/plugin/plugin.go
+++ b/plugin/plugin.go
@@ -662,12 +662,12 @@ func (p *OrmPlugin) generateConvertFunctions(message *generator.Descriptor) {
///// To Pb
p.P(`// ToPB runs the BeforeToPB hook if present, converts the fields of this`)
p.P(`// object to PB format, runs the AfterToPB hook, then returns the PB object`)
- p.P(`func (m *`, typeName, `ORM) ToPB (ctx context.Context) (`,
+ p.P(`func (m *`, typeName, `ORM) ToPB (ctx context.Context) (*`,
typeName, `, error) {`)
@russellsimpkins
russellsimpkins / example2.sh
Created June 30, 2016 14:46
Illustrating importing your custom vmod
$> /usr/bin/varnishtest –Dvmod_topbuild=/usr/local/builds/mmdb-vmod /usr/local/builds/mmdb-vmod/src/tests/test01.vtc
$> cat test02.vtc
varnishtest "Test example vmod"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
import geo from "${vmod_topbuild}/src/.libs/libvmod_geo.so";
import std;
@russellsimpkins
russellsimpkins / varnish-test2.sh
Last active August 26, 2016 18:10
Running Varnishtest with -D
$>/usr/bin/varnishtest –Dvarnishd=/usr/local/builds/Varnish-Cache/bin/varnishd /path/to/test01.vtc
# top TEST test01.vtc passed (0.747)
@russellsimpkins
russellsimpkins / varnish-test1.sh
Last active August 26, 2016 18:03
Running Varnish Test
$> /usr/bin/varnishtest /path/to/test01.vtc
# top TEST test01.vtc passed (0.747)
sub vcl_recv {
// remove jquery cache buster query parameter if it exists
if (req.url ~ "_=[0-9]+") {
set req.http.clean = regsuball(req.url, "(_=[0-9]+)", "");
set req.http.clean = regsub(req.http.clean, "\?&", "?");
set req.http.clean = regsub(req.http.clean, "&&", "&");
set req.http.clean = regsub(req.http.clean, "&$", "");
set req.http.clean = regsub(req.http.clean, "\?$", "");
// modify the url with the clean version
set req.url = req.http.clean;
varnishtest "Cache busting test"
server s1 {
rxreq
expect req.url == "/foo/svc.json?api-key=abc%20qwer1234&another=value&name=value"
txresp
} -start
varnish v1 -vcl+backend {
import std;
sub vcl_recv {
if (req.url ~ "_=[0-9]+") {