Skip to content

Instantly share code, notes, and snippets.

View derjohn's full-sized avatar

derjohn derjohn

View GitHub Profile
@derjohn
derjohn / rocket-user-mongodb
Last active May 31, 2023 07:34
Rocket.Chat rocket mongodb mongo basic operations
use rocketchat
# Change E-Mail Adress
db.getCollection('users').updateOne(
{ username: "Temp" },
{
$set: { emails: [ { "address" : "[email protected]", "verified" : true } ] }
}
)
@derjohn
derjohn / gpu-tune.sh
Created September 20, 2021 08:59
gpu custom settings helper script for ROC-smi-rocm ROCm Radeon on Compute
#!/bin/bash
# usage: ./gpu-tune.sh '1 3 5' # runs GPU Settings in card 1,3 and 5
# Settings must be coded into the script (no external config yet).
# But this still handy, if you work on just one card
GPUS=${1:-'1 2 3 4 5'}
ROCMDIR=./ROC-smi-rocm-3.9.0
function tune() {
DEV=$1
@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 November 18, 2024 07:22
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 [email protected] 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 }
]