Skip to content

Instantly share code, notes, and snippets.

View derjohn's full-sized avatar

derjohn derjohn

View GitHub Profile
@derjohn
derjohn / create-cloud-template.sh
Last active April 19, 2023 10:25 — forked from chriswayg/create-cloud-template.sh
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
#!/bin/bash
set -o errexit
clear
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### HOW TO USE
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1
#!/bin/sh
sudo apt-get -y remove docker docker-engine docker.io runc
sudo apt-get update
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
@derjohn
derjohn / update-huawei-matebook-firmware-linux.md
Last active March 27, 2024 19:05
Update your Huawei Matebook Pro X (and others) from the Linux shell with fwupd

Huawei Matebook BIOS update with Linux

Tested with Huawei Matebook X Pro (MACH-WX9) This is more or less a step by step tutorial, written 02/2021. Sadly at the moment Huawei does not ship a package in Linux Vendor Firmware Service.

WARNING

Please note that you can damage ("brick") your device if something goes wrong or is done incorrectly. This is for the advanced user! I can only say that I flashed the new firmware 0.1.33 to my MACH-WX9 successfully.

Original docs

dennemann.blog THX!!!

Howto manage a tomcat8/9 instance as a user (non-root)

Install tomcat8/9

Figure out yourself, probably use your distros package manager Create a user e.g. tomcat9user

Create an Instance

sudo -iu tomcat9user
tomcat9-instance-create -p 8081 -c 8006 ~/tomcat9specialservice-instance
@derjohn
derjohn / Setup-e-mail-to-fax-with-dusnet
Created September 24, 2020 10:56
E-Mail to Fax Gateway with a DUS.net account
# Goal: Send an PDF Attachment to an catchall E-Mail Adresss with the fax number LHS
# like +49123456778@myfax.example.com and have it processes as a Fax message.
# You need: an dus.net account and the crypto token for the subject-line-auth
# an catchall e-mail account like *@myfax.example.com with an own homedirectory
# This script will rewrite the e-mail target and subject and forward it to DUS.net.
1) Create a <USERHOME>/.procmailrc
LOGFILE=procmail-for-fax.log
VERBOSE=YES
@derjohn
derjohn / create-memorylimited-slice
Created September 24, 2020 08:25
It creates a systemd "slice" with a memory limit. Ideal if e.g. firefox or chromium eat up all your memory and block your whole desktop. The slice will be OOM killed by systemd / cgroups, if it runs of bounds.
#!/bin/bash
# It creates a systemd "slice" with a memory limit. Ideal if e.g. firefox or chromium eat up all your memory and block your whole desktop.
# The slice will be OOM killed by systemd / cgroups, if it runs of bounds.
# usage: ./create-memorylimited-slice /path/to/your/binary
SLICEPATH=${1:-'/usr/bin/firefox'}
SLICENAME=$(basename ${SLICEPATH})
## Create system-wide scripts
cat <<EOF | sudo tee /usr/local/bin/${SLICENAME}-slice > /dev/null
@derjohn
derjohn / rdp-connect.sh
Created September 8, 2020 09:54
rdp connect script with smart resizing and scaling (using xfreerdp v2 !)
#!/bin/sh
# Example usage RDPHOST=127.0.0.1 RDPPASS=foobar RDPUSER=admin rdp-connect.sh
if ! xfreerdp --version | grep -q 'version 2\.'; then echo "Please apt install freerdp2-x11"; exit 1; fi
RDPHOST=${1:-""}
RDPPASS=${RDPPASS:-""}
RDPUSER=${RDPUSER:-""}
RDPTITLE=${RDPTITLE:-"${RDPHOST}"}
RDPDRIVE=${RDPDRIVE:-'/tmp/'}
@derjohn
derjohn / daemon.json
Last active July 13, 2023 14:25
Docker Config with IP address range that does not collide with the Wifi of Deutsche Bahn DB
/etc/docker/daemon.json
{
"bip" : "172.70.0.1/16",
"fixed-cidr" : "172.70.16.0/20",
"log-level" : "info",
"default-address-pools" : [
{"base" : "172.80.0.0/16", "size" : 24 },
{"base" : "172.90.0.0/16", "size" : 24 }
]

Keybase proof

I hereby claim:

  • I am derjohn on github.
  • I am derjohn (https://keybase.io/derjohn) on keybase.
  • I have a public key whose fingerprint is EE7A 1F2F 1111 1299 A921 0830 79AA 0D82 0805 1F6C

To claim this, I am signing this object:

@derjohn
derjohn / android_backup_restore.sh
Last active May 30, 2019 16:04 — forked from silvae86/android_backup_restore.sh
Backup and restore Android partitions to SD Card
#!/bin/sh
#open adb shell
adb shell
#listing partitions (general command for Android devices)
#ls -l /dev/block/platform/<block_device_name>/by-name/
#for the ZTE Axon7
ls -l /dev/block/platform/soc/624000.ufshc/by-name/