Skip to content

Instantly share code, notes, and snippets.

View defaye's full-sized avatar

Jono Feist defaye

  • England
View GitHub Profile
@defaye
defaye / ufw_vpn_killswitch_tutorial.md
Created January 31, 2021 22:43 — forked from Necklaces/ufw_vpn_killswitch_tutorial.md
GNU/Linux UFW VPN kill switch tutorial

GNU/Linux UFW VPN kill switch tutorial

This is a quick guide for setting up a kill switch using UFW (Uncomplicated FireWall). It is assumed you are using OpenVPN and optionally Network-Manager with network-manager-openvpn.

1. (Optional) IP Addresses

Before we can start we're going to need the IP address (or the IP addresses) of your VPN so that we can whitelist those later on, write them down. They are obviously going to be different for every VPN and VPNs with multiple servers, so I'll leave this up to you.

2. Install UFW

On some systems UFW is installed and enabled by default (Ubuntu, for example). Installation procedure is going to be different for every distribution of GNU/Linux, but it's usually something like

@defaye
defaye / without_vue_i18n_translate_helper.js
Created March 11, 2021 12:38
Translation helper to be used with messages in a Vue store
import { at } from 'lodash'
Vue.prototype.$t = function (translationKey, options) {
const rawTranslation = at(this.$store.state.translations.translations, translationKey)
let translation = rawTranslation[0]
for (let key in options) {
translation = translation.replace(`%{${key}}`, options[key])
}
@defaye
defaye / install_aws_cli.sh
Created July 12, 2021 11:18
Install AWS CLI Ubuntu 18.04
mkdir aws_cli_installation_temp
cd aws_cli_installation_temp
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
cd ..
rm -rf aws_cli_installation_temp
<template>
<div>
<button
@click="$refs['staged-files'].show()"
class="btn btn-primary w-100"
type="button"
>
Upload Images
</button>
<input
@defaye
defaye / install_older_versions_of_ruby_on_ubuntu_22_04.sh
Created May 9, 2022 23:28
Installing Older Ruby Versions on Ubuntu 22.04 with rbenv
# adapted from https://deanpcmad.com/2022/installing-older-ruby-versions-on-ubuntu-22-04/
mkdir ~/.openssl
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
tar zxvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./config --prefix=/home/$USER/.openssl/openssl-1.1.1g --openssldir=/home/$USER/.openssl/openssl-1.1.1g
make
make test
make install
rm -rf ~/.openssl/openssl-1.1.1g/certs
@defaye
defaye / swap_pg_version.sh
Created January 26, 2024 16:35
Swap Postgres version via Homebrew
swap_pg_version() {
if [ $# -ne 1 ]; then
echo "Usage: swap_pg_version <version>"
return 1
fi
TARGET_VERSION="postgresql@$1"
# List all installed PostgreSQL versions
INSTALLED_VERSIONS=$(brew list --formula | grep 'postgresql@')
@defaye
defaye / open_coverage_report.sh
Created February 6, 2024 14:23
open code coverage report
open_coverage_report() {
# Find the coverage/index.html file, excluding node_modules and prioritizing higher-level directories
local file=$(find . -type d -name "node_modules" -prune -o -type f -name "index.html" -path "*/coverage/*" -print | head -n 1)
# Check if the file was found
if [[ -n "$file" ]]; then
# Open the file in the default browser or Firefox if the default is not set
open -a "Firefox" "$file" || open "$file"
else
echo "No coverage/index.html file found in the current directory or its subdirectories."