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 / Set up GitHub push with SSH keys.md
Last active May 18, 2024 17:58 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "your_email@example.com"
@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 / pihole-macvlan-synology-docker.txt
Last active April 13, 2024 17:10
Add a PiHole instance on a macvlan enabled Docker network (Synology eth0 example)
#!/bin/bash
# NAS IP: 192.168.1.10 in this example
# DHCP scope reservation for macvlan: 192.168.1.210/28 (Details below)
## Network: 192.168.1.210/28
## HostMin: 192.168.1.211
## HostMax: 192.168.1.224
## Hosts/Net: 14
# Create a Synology macvlan0 bridge network attached to the physical eth0, and add the ip range scope (sudo)
@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...
#!/bin/bash
function __set_proxy_envs() {
NO_PROXY_ENV="no_proxy NO_PROXY"
PROXY_ENV="http_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY ALL_PROXY"
}
function __unset_proxy_envs() {
unset NO_PROXY_ENV PROXY_ENV
}
@xirixiz
xirixiz / corporate proxy bash without cntlm.md
Last active November 13, 2021 07:28
corporate proxy bash without cntlm

You can also make things static, like PROXY_USER, PROXY_SERVER, PROXY_PORT, but my advice is to never add the password. Ofcourse, when possible, you could also use CNTLM or CNTLM in Docker. However, I experienced that I couldn't use it always with CNTLM, hence this script, which I souce from ~/.bashrc

For the password you could also setup an ENV VAR called DOMAIN_PASSWORD. Long story short, I use it together with encrypted secrets to set this ENV VAR, but I didn't want to add it here :).

Usage: source ~/proxy.sh proxy_enable

@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)
#!/bin/python2s
# Symbolic name, meaning all available interfaces
VAR_HOST = ""
# Arbitrary non-privileged port
VAR_PORT = 9003
import socket
import sys
@xirixiz
xirixiz / UGW3_Wireguard.md
Last active February 25, 2024 22:12 — forked from pamolloy/README.md
Ubiquiti USG configuration for Wireguard

The purpouse is to have a WireGuard server running with a configuration for 2 clients to connect to the WireGuard server.

Installation - First steps

Follow the instructions for downloading and installing the WireGuard package here: https://github.com/WireGuard/wireguard-vyatta-ubnt

curl -OL https://github.com/WireGuard/wireguard-vyatta-ubnt/releases/download/${RELEASE}/${BOARD}-${RELEASE}.deb
sudo dpkg -i ${BOARD}-${RELEASE}.deb