Skip to content

Instantly share code, notes, and snippets.

View mietzen's full-sized avatar

Nils mietzen

View GitHub Profile

Update custome Proxmox container templates

I like to use a custom debian container image, that has some tools installed and a non root user setup. I then dump and export the rootfs as container template.

To keep this template updated, I wrote this script.

This script works for all distribitions, you just have to update the variables:

#!/bin/bash
@mietzen
mietzen / SynoCommunity-autoupdate.md
Last active April 8, 2024 08:26
A shell script to auto update SynoCommunity Packages

Auto Update SynoCommunity Packages

I always had the problem that synology doesn't let us auto update 3rd party packages such as the ones from SynoCommunity, so I wrote a shell script to auto update SynoCommunity Packages:

#! /bin/bash -e

PATH="/bin:/usr/syno/bin:${PATH}"

SYSTEM_PKGS=$(synopkg checkupdateall)
@mietzen
mietzen / X710_OEM_crossflash.md
Last active April 29, 2024 13:48
X710 OEM crossflash

How to crossflash intel X710 OEM cards

Disclaimer

ONLY do this if you understand what this script does and when you are sure that this method is applicable to your card!!!

I'm not responsible for your doings! You are flashing the firmware of your ethernet card, in the worst case you endup with a soft- or even hardbricked card! Also this might void your warrenty.

Having said this, if you are uncertain if this will work for your card be sure to dump the ROM with a RPI, RPI Pico or 3.3v moded SPI-Flash Programmer:

@mietzen
mietzen / m720q_setup.md
Last active April 20, 2024 05:14
m720q Setup: i7 8700 65W

m720q Setup with an i7-8700 65W

I had trouble getting my i7-8700 65W to work in my m720q with a 65W PSU. It was working fine in Windows, but was throttling down first to 20 Watt, then to 15, 10, and finally to 7 Watt, which resulted in a maximum clock speed of 800 MHz.

The main problem seems to be a mix of crappy firmware settings from Lenovo/Intel (Reddit Post) and the weak power supply.

To fix this problem, we have to install some tools, and for them to work, you have to make sure that secure boot is OFF; otherwise, the kernel doesn't allow you to set the CPU power limits. The easiest way is to install in legacy mode; therefore, you need to disable secure boot and enable CSM in the BIOS, select legacy boot preferred.

@mietzen
mietzen / bump-version
Last active August 16, 2023 04:59 — forked from siddharthkrish/version.sh
simple bash script to increment the version number of the format major.minor.bug
#!/usr/bin/env bash
help () {
echo "usage: ./bump-version version_number [major/minor/bug]"
}
# Check input remove prepending 'v'
if grep -q -c -E '^v?[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}$' <<< ${1}; then
version=$(sed 's/^.\{1\}//g' <<< ${1})
else
@mietzen
mietzen / macos-bitwarden-cli-ssh.md
Last active April 30, 2024 08:52
How to use use Bitwarden CLI for SSH-Keys in macOS

How to use use Bitwarden CLI for SSH-Keys in macOS

If you want to use Touch ID have a look at: How to use use Bitwarden CLI with macOS Touch ID

Wirtten and tested on macOS Ventura

Add SSH-Keys to Bitwarden

Before you can use Bitwarden CLI for your SSH private keys you have to add them to your Bitwarden account. Just create a normal login. The name, username and URI fields doesn't matter for my functions.

@mietzen
mietzen / macos-bitwarden-cli-with-touch-id.md
Last active April 26, 2024 17:57
How to use use Bitwarden CLI with macOS Touch ID

How to use Bitwarden CLI with macOS Touch ID

If you want to use Bitwarden CLI for ssh have a look at: How to use use Bitwarden CLI for SSH-Keys in macOS

Wirtten and tested on macOS Ventura

Configure Touch ID for the sudo command

To allow Touch ID on your Mac to authenticate you for sudo access instead of a password you need to do the following.

@mietzen
mietzen / change_ssh_pub_key.sh
Created October 16, 2022 14:23
Change your ssh pub key on all systems
#!/bin/bash -xe
NEW_PUB_KEY="$HOME/.ssh/id_ed25519.pub"
OLD_PUB_KEY="$HOME/.ssh/id_rsa.pub"
NEW_PUB_KEY_STR=$(cat ${NEW_PUB_KEY})
OLD_PUB_KEY_STR=$(cat ${OLD_PUB_KEY} | cut -d' ' -f2)
for IP in $(cat ip-list-ssh.txt); do
# Backup authorized_keys
ssh ${USER}@${IP} "cp ~/.ssh/authorized_keys{,.bak}"
# Add new key to authorized_keys
@mietzen
mietzen / openwrt-refresh-mullvad-wireguard-publickey.sh
Last active May 7, 2022 18:18
Use this script to refresh your mullvad wireguard publickey on OpenWRT:
#!/bin/bash
OLD_PUBLIC_KEY=$(uci get network.mullvad.private_key | wg pubkey)
logger -p notice -t "Changing Wireguard Publickey" "Old Publickey=$OLD_PUBLIC_KEY"
logger -p notice -t "Changing Wireguard Publickey" "Old Privatekey=$(uci get network.mullvad.private_key)"
logger -p notice -t "Changing Wireguard Publickey" "Old IPs=$(uci get network.mullvad.addresses)"
PRIVATE_KEY=$(wg genkey)
logger -p notice -t "Changing Wireguard Publickey" "New Privatekey=$PRIVATE_KEY"
PUBLIC_KEY=$(echo "$PRIVATE_KEY" | wg pubkey)
logger -p notice -t "Changing Wireguard Publickey" "New Publickey=$PUBLIC_KEY"
@mietzen
mietzen / pi-hole.conf
Created May 5, 2022 07:23
/etc/unbound/unbound.conf.d/pi-hole.conf
server:
# If no logfile is specified, syslog is used
# logfile: "/var/log/unbound/unbound.log"
verbosity: 0
interface: 127.0.0.1
port: 5335
do-ip4: yes
do-udp: yes
do-tcp: yes