Skip to content

Instantly share code, notes, and snippets.

View xirixiz's full-sized avatar

Bram van Dartel xirixiz

View GitHub Profile
@xirixiz
xirixiz / gpg-import-and-export-instructions.md
Created March 30, 2018 23:42 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@xirixiz
xirixiz / git_clone_all.sh
Last active December 19, 2018 07:03
Clone all projects from a GitLab group, even for +100 pages.
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
#---------------------------------------------------------------------------------------------------------------------------
# INFO
#---------------------------------------------------------------------------------------------------------------------------
# ./git_clone_all.sh <group> <token> <url> <branch>
@xirixiz
xirixiz / gist:0964bd49bd5fa3e478744f81465fca5a
Created October 4, 2019 12:46 — forked from tonyklawrence/gist:b477dcf624577ab154ed3b51cea60e27
Docker containers using VLAN network on Synology DSM 6.X
First we need to create the VLAN on the Synology from the command line:
See: https://nielshagoort.com/2016/03/30/synology-vlan-tagging/
Then add Network to Docker using maclvan driver
See: https://docs.docker.com/engine/userguide/networking/get-started-macvlan/#macvlan-8021q-trunk-bridge-mode-example-usage
Details...
@xirixiz
xirixiz / WSL2-Windows10-1903-1909-DNS-Fix.md
Last active October 2, 2020 07:46
WSL 2 Support for Windows 10 Versions 1903 and 1909 (DNS resolving issues)
# Bram van Dartel: Fix WSL2 network connection after setting up a Cisco Anyconnect VPN.
# Boot your laptop, start Docker and WSL2, setup a Cisco Anyconnect VPN connection, run this fix.
function Fix-WSLNet {
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
Get-NetIPInterface -InterfaceAlias "vEthernet (WSL)" | Set-NetIPInterface -InterfaceMetric 1
Get-NetAdapter | Where-Object { $_.InterfaceDescription -Match "Cisco AnyConnect" } | Set-NetIPInterface -InterfaceMetric 6000
}
Fix-WSLNet
@xirixiz
xirixiz / ventilation.yaml
Created February 21, 2021 15:11 — forked from SqyD/ventilation.yaml
ESPHome PWM fan using a Wemos D1 mini lite
# Controlling my Buva Qstream ventilation system using:
# * A Wemos D1 mini lite (an ESP8266 based board)
# * A Wemos power shield so I can power the Wemos from the ventilation units 12V supply.
# * A simple PWM to 10V convertor like this: https://www.cheaptech.nl/pwm-signaal-te-voltage-converter-1-3-khz-0-10-v-pw.html
# * The amazing ESPHome firmware tool: https://esphome.io
# * Home Assistant to tie it all together: https://www.home-assistant.io
#
# I used to use a Raspberry Pi and some Python code for this. See https://gist.github.com/SqyD/a927ab612df767a0cc892bcde23d025c
# The Wemos approach seems more stable and doesn't require external USB power.
# export private keys
gpg --export-secret-keys --armor > gpg-private.keys
# import private keys
gpg --import gpg-private.keys
# export public keys
gpg --export --armor > gpg-public.keys
# import public keys
@xirixiz
xirixiz / reverse_filename.sh
Created April 7, 2021 19:32
Reverse Filname Script
#!/bin/bash
# Change to current dir.
cd "$(pwd)"
# Check if a parameter is given
if [[ -e $1 ]]
then # if a selection is found, just count the files in that selection
files="$1"
total=$(ls "$files" | wc -l)
@xirixiz
xirixiz / zone_instructions
Created April 12, 2021 05:44 — forked from wassupdoc/zone_instructions
Zone settings for edgerouter
#based on http://www.forshee.me/2016/03/02/ubiquiti-edgerouter-lite-setup-part-2-firewall-setup.html
configure
edit firewall name allow-est-drop-inv
set default-action drop
set enable-default-log
set rule 1 action accept
set rule 1 state established enable
set rule 1 state related enable
set rule 2 action drop
@xirixiz
xirixiz / glinet_adblock_install
Created August 20, 2021 09:46
GL-Inet AdBlock
- Install wget
- Install tcpdump-mini
- Install luci-app-adblock
- Using the luci interface, go to Services | Adblock
- Click Enable Adblock.
- Down this page there are a number of block lists. Pick those that you need.
- Enable force local DNS.
- Startup Trigger Interface: lan
- Advanced Report Settings -> Reporting Interface: lan
- Click Save and Apply.