Skip to content

Instantly share code, notes, and snippets.

View xirixiz's full-sized avatar

Bram van Dartel xirixiz

View GitHub Profile
@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.
# 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 / 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
#!/bin/python2s
# Symbolic name, meaning all available interfaces
VAR_HOST = ""
# Arbitrary non-privileged port
VAR_PORT = 9003
import socket
import sys
@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)
@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

#!/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 / 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 / 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 / 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>