Skip to content

Instantly share code, notes, and snippets.

View DrJume's full-sized avatar

Julian Meinking DrJume

View GitHub Profile
@DrJume
DrJume / USEFUL_CMDS.md
Last active October 16, 2018 17:38
A selection of useful bash commands and shortcuts
One Line FTP server
python -m pyftpdlib --help
Run last command again as sudo
sudo !!
#!/bin/bash
RUNCMD=./ServerStart.sh
TIMEOUT=20
while true; do
$RUNCMD
echo $(date +"%a %d.%m.%y %T:%N") >> autostart.log
echo
echo "[==============================]"

Keybase proof

I hereby claim:

  • I am drjume on github.
  • I am drjume (https://keybase.io/drjume) on keybase.
  • I have a public key ASA3xV0T3PmqTgByUd8rXuj3jrPWN8ptWvkKv4PZBxvtiAo

To claim this, I am signing this object:

@DrJume
DrJume / bash_snippets.md
Last active April 17, 2020 02:27
My collection of cool snippets
Pipe command output to a logging service
apimon -c apimon.yml |      # Prints JSON messages
  while IFS= read -r json   # Read line by line. $json holds the line content
  do
    # Send JSON over a HTTP Post request
    echo $json | curl -H "Content-Type: application/json" -X POST -d @- http://yourloggingserver:4321
  done
@DrJume
DrJume / lancache_fritzbox.md
Last active September 1, 2024 16:33
Using lancache with a FritzBox

Using lancache with a FritzBox is not very straight forward:

  1. You need to have access to the DNS settings in the FritzBox web interface. Some providers disable this setting to force their customers with specific settings, like their own (mostly slow) DNS servers.
  2. Set both DNS server entries to your local IP address, on which the lancache is accessable.
  3. The FritzBox has a DNS rebind protection. To disable this for the hostnames, which are used for the lancache, you need to specify them as a list format in the web interface.

All the hostnames can be found at uklans/cache-domains. Download the repo and switch into the directory.

@DrJume
DrJume / teamspeak-snapshot.sh
Last active September 12, 2020 00:03
TeamSpeak server query snapshot helper script
#!/bin/bash
set -e
set -u
# set -x # during dev
printUsage() {
cat <<EOF >/dev/stderr
Usage: $0 [protocol://][user@]host[:port] (password) action [-s sid] [-f snapshot_file]
@DrJume
DrJume / backup-container-volumes.sh
Last active November 26, 2024 13:40
Backup all mounted volumes in a Docker container into a .tar.gz archive
#!/bin/bash
# Author: @DrJume
# This script lets you backup all mounted volumes of a Docker container
# into a .tar.xz archive.
# Throw on nonzero exit in pipelines
set -e
@DrJume
DrJume / install-docs-apk.sh
Created November 7, 2020 08:20
Alpine script using ncurses dialog which helps with installing missing *-doc packages from apk
#!/bin/sh
[ ! -x "$(command -v dialog)" ] && ( apk add dialog || exit)
installed_pkgs=$(apk list -I -q | awk '{ print $1 }' | sed -E 's/(.+)(-[[:digit:]]).+/\1/')
installed_pkgs_doc=$(echo "$installed_pkgs" | grep "\-doc")
installed_pkgs_without_doc=$(echo "$installed_pkgs" | grep -v '\-doc')
installed_pkgs_append_doc=$(echo "$installed_pkgs_without_doc" | awk '{ print $0"-doc" }')
@DrJume
DrJume / applescript_open_terminal.md
Created December 10, 2020 05:58
AppleScript open terminal snippets
tell application "Terminal"
	do script "echo Hello world"
end tell
tell application "iTerm"
	set newWindow to (create window with default profile)
	tell current session of newWindow
@DrJume
DrJume / api-proxy-factory.js
Created May 17, 2021 16:29
JavaScript Proxy object for translating object property accesses to API call urls
/**
* @typedef API
* @property {object} users
* @property {()} users.getById
* @property {()} users.getByName
*/
/** @returns {API} */
function ProxyFactory() {
return Proxy({}, handler)