Skip to content

Instantly share code, notes, and snippets.

Terin Stock terinjokes

Block or report user

Report or block terinjokes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@terinjokes
terinjokes / klogs.zsh
Last active Nov 21, 2018
FZF function for Kubernetes logs (including previewing)
View klogs.zsh
klogs() {
pod="$(kubectl get po -o wide|tail -n+2|fzf -n1 --reverse --tac --preview='kubectl logs --tail=20 --all-containers=true {1}' --preview-window=down:50%:hidden --bind=ctrl-p:toggle-preview --header="^P: Preview Logs"|awk '{print $1}')"
if [[ -n $pod ]]; then
kubectl logs --all-containers=true $pod
fi
}
@terinjokes
terinjokes / vpnc-v6-split.patch
Created Apr 4, 2018
patch to never set the default route for split IPv6
View vpnc-v6-split.patch
diff -ura vpnc-scripts.orig/vpnc-script vpnc-scripts.new/vpnc-script
--- vpnc-scripts.orig/vpnc-script 2018-04-04 11:39:54.203748883 -0700
+++ vpnc-scripts.new/vpnc-script 2018-04-04 11:52:22.039505461 -0700
@@ -676,11 +676,7 @@
while [ $i -lt $CISCO_IPV6_SPLIT_INC ] ; do
eval NETWORK="\${CISCO_IPV6_SPLIT_INC_${i}_ADDR}"
eval NETMASKLEN="\${CISCO_IPV6_SPLIT_INC_${i}_MASKLEN}"
- if [ $NETMASKLEN -lt 128 ]; then
- set_ipv6_network_route "$NETWORK" "$NETMASKLEN"
- else
@terinjokes
terinjokes / client.go
Last active Apr 22, 2017
Golang example of context in API Clients
View client.go
package api
import (
"encoding/json"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
)
type Client {
@terinjokes
terinjokes / foobar.ex
Last active Dec 30, 2015
Simple Elixir lambda example
View foobar.ex
defmodule FooBar do
def update_header(headers, key, fun) do
if List.keymember?(headers, key, 0) do
value = fun.(headers)
List.keystore(headers, key, 0, {key, value})
else
value = fun.(nil)
List.keystore(headers, key, 0, {key, value})
end
end
View 01-underground.md

Single word London Underground stations

  • Bermondsey
  • Upney
  • Neasden
  • Croxley
  • Hainault
  • Gunnersbury
  • Greenford
  • Leytonstone
  • Chigwell
View 01-sf-neighborhoods.md

San Francisco Neighborhoods

  • Alamo Square
  • Anza Vista
  • Ashbury Heights
  • Balboa Park
  • Balboa Terrace
  • Bayview
  • Belden Place
  • Bernal Heights
  • Buena Vista
View 1200-test.js
var browserify = require('./');
var through = require('through2');
var b = browserify('./test/entry/main');
var spawn = require('child_process').spawn;
var wrap = b.pipeline.get('wrap');
var n = spawn('node');
var out = through();
@terinjokes
terinjokes / build.js
Created Feb 18, 2015
Requiring a dynamically created file with Browserify
View build.js
var Browserify = require('browserify');
var Readable = require('stream').Readable;
function stringStream(content) {
var s = new Readable();
s.push(content);
s.push(null);
return s;
}
View closure.swift
// anonymous function
numbers.map({
(number: Int) -> Int in
let result = 3 * number
return result
})
// implicit return for single statements
numbers.map({ number in 3 * number })
View loader.js
function encodeData(data) {
var result = [];
forEach(data, function(value, key) {
if (isArray(value)) {
forEach(value, function(url) {
result.push(encodeURIComponent(key) + '[]=' + encodeURIComponent(url));
});
} else {
result.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
You can’t perform that action at this time.