Skip to content

Instantly share code, notes, and snippets.

View cmd-johnson's full-sized avatar

Jonas Auer cmd-johnson

  • Villingen-Schwenningen, Germany
View GitHub Profile
@cmd-johnson
cmd-johnson / gist:8fa0aa067126746bbf8f3b8cdbd71d55
Last active August 20, 2019 21:54
Service Worker Cache Debugging

Get single cached response

(async (cid, rid) => {
  const cacheKeys = await caches.keys();
  const cacheName = cacheKeys[cid];
  const cache = await caches.open(cacheName);
 
  const keys = await cache.keys();
 const key = keys[rid];
#!/usr/env/bash
rgb()
{
# takes three values for red, green and blue ranging from
# 0-5 each and prints the corresponding color escape sequence
# (formula from http://stackoverflow.com/a/27165165)
local r="${1:-"0"}"
local g="${2:-"0"}"
local b="${3:-"0"}"
@cmd-johnson
cmd-johnson / create-ovpn-client-certs
Last active July 13, 2016 10:19
Creates client certificates to be used with an OpenVPN server and outputs ovpn file contents for the new client
#!/usr/bin/env bash
# Creates OpenVPN client certificates and outputs ovpn file contents
# Typical usage would be to redirect stdout to a *.ovpn file:
# ./create-ovpn-client-certs client1 > ServerName.ovpn
# Edit these paths to match your openvpn/easy-rsa configuration
EASY_RSA_PATH=/etc/openvpn/easy-rsa
KEY_DIR=$EASY_RSA_PATH/keys
CA_CERT_PATH=/etc/openvpn/ca.crt