Skip to content

Instantly share code, notes, and snippets.

View benjaminapetersen's full-sized avatar
👾

Ben Petersen benjaminapetersen

👾
View GitHub Profile
@benjaminapetersen
benjaminapetersen / xvfb
Created March 1, 2018 13:57 — forked from jterrace/xvfb
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@benjaminapetersen
benjaminapetersen / b64.js
Created April 4, 2018 02:29 — forked from xuezaijiongtu/b64.js
Base64 Function for JS
/*
Copyright Vassilis Petroulias [DRDigit]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@benjaminapetersen
benjaminapetersen / responsivle_mediaqueries.sass
Created April 22, 2018 04:16 — forked from chsh/responsivle_mediaqueries.sass
Responsive Media Queries example from "bulma"
// Responsiveness
$tablet: 769px !default
// 960px container + 40px
$desktop: 1000px !default
// 1152px container + 40
$widescreen: 1192px !default
// 960 and 1152 have been chosen because
// they are divisible by both 12 and 16
@benjaminapetersen
benjaminapetersen / local-bridge-installer.md
Created November 8, 2018 20:29 — forked from SamiSousa/local-bridge-installer.md
Launching bridge from 4.0 installer libvirt

Running console on installer via libvirt

The goal of this is to run a local version of console connected to a 4.0 OpenShift cluster created with the installer.

Once you have a running cluster running via libvirt, make sure you've set your environment variable for KUBECONFIG to point to the credentials for your cluster:

export KUBECONFIG=/path/to/installer/auth/kubeconfig
@benjaminapetersen
benjaminapetersen / generate-ssh-key.sh
Last active October 17, 2019 19:43 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "<you>@<email.com>" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "<you>@<email.com>" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "<you>@<email.com>" -f ~/.ssh/mozilla_rsa
@benjaminapetersen
benjaminapetersen / golang-tls.md
Created November 8, 2019 15:25 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@benjaminapetersen
benjaminapetersen / srd_5e_monsters.json
Created November 12, 2019 20:02 — forked from tkfu/srd_5e_monsters.json
A JSON file with all the D&D 5e SRD monster data
[
{
"name": "Aboleth",
"meta": "Large aberration, lawful evil",
"Armor Class": "17 (Natural Armor)",
"Hit Points": "135 (18d10 + 36)",
"Speed": "10 ft., swim 40 ft. ",
"STR": "21",
"STR_mod": "(+5)",
"DEX": "9",
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content-Security-Policy</title>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Security-Policy"
content="default-src 'self' data: gap: 'unsafe-eval' ws: ;
style-src 'self' 'unsafe-inline';
script-src https: *.example.com ;
@benjaminapetersen
benjaminapetersen / 1-setup.md
Created July 21, 2020 20:35 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

@benjaminapetersen
benjaminapetersen / trap_focus.js
Created December 17, 2020 22:26 — forked from myogeshchavan97/trap_focus.js
Code for trapping focus inside modal
// add all the elements inside modal which you want to make focusable
const focusableElements =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const modal = document.querySelector('#exampleModal'); // select the modal by it's id
const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
const focusableContent = modal.querySelectorAll(focusableElements);
const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal