Skip to content

Instantly share code, notes, and snippets.

View jwreagor's full-sized avatar

J R jwreagor

  • New Gillington, WI
View GitHub Profile
@jwreagor
jwreagor / EmacsKeyBinding.dict
Created March 20, 2014 18:41
Global Emacs Key Bindings for OS X
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
* BEWARE:
* This file uses the Option key as a meta key. This has the side-effect
* of overriding Mac OS keybindings for the option key, which generally
@jwreagor
jwreagor / TEA.txt
Last active October 8, 2023 23:17
Russian Tea HOWTO for Linux Hackers
Russian Tea HOWTO
Dániel Nagy <nagydani@fazekas.hu>
v1.0, April 1, 2002
Caffeine is essential for keeping the brain active during nightly
hacking sessions. There are, however, many ways to satisfy a hacker's
need for caffeine. Drinking Canned Capitalism (Coke) contradicts the
very principles of the open source movement, for it is a closed
source product, manufactured by a huge, evil corporation. This sweet
brown fizzy water is unhealthy and does not leave any space for cre­
@jwreagor
jwreagor / create-jwt-using-unix-commands-on-mac.md
Created February 15, 2017 18:27 — forked from indrayam/create-jwt-using-unix-commands-on-mac.md
Create JWT Token Header Using Unix Command line tools ONLY!

Pseudocode:

Y = Base64URLEncode(Header) + ‘.’ + Base64URLEncode(Payload)
JWT = Y + ‘.’ + Base64URLEncode(HMACSHA256(Y))

The steps called out here should work on a Mac as well. The only thing that might be different is the sed command used below. Instead of using -E, you will have to use -r to run sed with extended regular expression support

Use data from this tutorial:

scotch.io

@jwreagor
jwreagor / node-k8s-watcher.js
Last active April 16, 2020 22:12
Kubernetes Watcher written in Node.js
'use strict';
// You use the `ResourceVersion` when making the initial query. So keep track
// of that upon successful reads and when you need to recreate the watcher from
// the last known point, pass in the `ResourceVersion` in the query.
const fs = require('fs')
const http = require('http')
const K8S_HOST = process.env['K8S_HOST'] || '10.100.0.1'
package main
import (
"context"
"fmt"
"os"
"github.com/jackc/pgtype"
"github.com/jackc/pgx"
)
@jwreagor
jwreagor / sshd.go
Created September 30, 2019 14:42 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@jwreagor
jwreagor / cds-ui.nginxconf
Last active August 19, 2019 19:51
Nginx configuration for fronting OVH CDS UI
server {
listen 80;
listen [::]:80;
root /opt/cds/dist;
index index.html;
location /assets/worker/cdsapi/events {
gzip_static off;
}
@jwreagor
jwreagor / as_yaml.rb
Created May 21, 2012 17:15
ActiveModel::Serializers::YAML
# require 'active_support/core_ext/class/attribute'
module ActiveModel
# == Active Model YAML Serializer
module Serializers
module YAML
extend ActiveSupport::Concern
include ActiveModel::Serialization
included do
@jwreagor
jwreagor / backoff.go
Last active December 9, 2018 18:07
Backoff Reference/Example
package main
import (
"context"
"errors"
"fmt"
"os"
"time"
"github.com/cenkalti/backoff"