Skip to content

Instantly share code, notes, and snippets.

@jpweber
jpweber / monzo-alertmanager-config.yaml
Created March 13, 2020 23:33 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@jpweber
jpweber / usb_hid_keys.h
Created September 22, 2019 04:11 — forked from MightyPork/usb_hid_keys.h
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@jpweber
jpweber / gist:42462c8409793ccd19585bacbdcb7270
Created January 31, 2019 03:19 — forked from jefferai/gist:e2bebc3bb97fed521666
Example of Vault PKI (X509) backend issuing certificates to client and server, which then perform TLS mutual auth
package main
import (
"crypto/tls"
"fmt"
"html"
"io/ioutil"
"log"
"net"
"net/http"
@jpweber
jpweber / fish_right_prompt.fish
Created July 25, 2017 00:22 — forked from mgoodness/fish_right_prompt.fish
Add the current Kubernetes context to the right-hand side of your Fish Shell prompt
function fish_right_prompt
set -l k8s_color (set_color blue)
set -l k8s_context (kubectl config current-context)
echo -e -n -s $k8s_color "($k8s_context)"
end
@jpweber
jpweber / go_port_forwarding.go
Created April 28, 2017 21:26 — forked from qhwa/go_port_forwarding.go
network port forwarding in go lang
package main
import (
"fmt"
"io"
"net"
)
func main() {
ln, err := net.Listen("tcp", ":8080")
@jpweber
jpweber / gist:ab162e0f0612f615c1cabbd936e20d72
Created September 7, 2016 15:08 — forked from jiecuoren/gist:0d0bff2efa48e03c2fc5
when use fish, something you will find error: E79: Cannot expand wildcards
open ~/.config/fish/config.fish
add: set -x SHELL /bin/bash
@jpweber
jpweber / gist:3020c5ccba7f80f6df66c8768b81e1eb
Created August 17, 2016 01:57 — forked from philips/gist:7310435
Setting up swap on coreos

Setup a swap file in the stateful partition

Run these commands as root to create a 512 megabyte swap.

fallocate -l 512m /media/state/512MiB.swap
chmod 600 /media/state/512MiB.swap
mkswap /media/state/512MiB.swap
@jpweber
jpweber / wildcard-ssl-cert-for-testing-nginx-conf.md
Created May 5, 2016 14:22 — forked from sr75/wildcard-ssl-cert-for-testing-nginx-conf.md
create a self signed wildcard ssl cert for testing with nginx.conf example

just change out app_name for your purposes

openssl genrsa 2048 > app_name-wildcard.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key app_name-wildcard.key > app_name-wildcard.cert

# Common Name (eg, your name or your server's hostname) []:*.app_name.com

openssl x509 -noout -fingerprint -text < app_name-wildcard.cert > app_name-wildcard.info
@jpweber
jpweber / tomcat-service.sh
Last active March 14, 2017 17:48 — forked from lesstif/tomcat-service.sh
RHEL/CentOS tomcat7 init.d service script.
#!/bin/bash
#
# tomcat
#
# chkconfig: 345 96 30
# description: Start up the Tomcat servlet engine.
#
# processname: java
# pidfile: /var/run/tomcat.pid
#
# Makefile for a go project
#
# Author: Jon Eisen
# site: joneisen.me
#
# Targets:
# all: Builds the code
# build: Builds the code
# fmt: Formats the source files
# clean: cleans the code