Skip to content

Instantly share code, notes, and snippets.

View wrzlbrmft's full-sized avatar

Matthias wrzlbrmft

  • Munich, Germany
View GitHub Profile
gdk-pixbuf-query-loaders --update-cache
@wrzlbrmft
wrzlbrmft / _enc-mount.sh
Last active June 17, 2016 14:11
Mounts and unmounts EncFS by taking folder name out of script's file name.
#!/usr/bin/env bash
# to be used as symlink, e.g. ./foobar-mount.sh -> ~/bin/_enc-mount.sh
# will mount encrypted dir ./.foobar to mount point ./foobar
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_FILE="$(basename "${BASH_SOURCE[0]}")"
SCRIPT_NAME="${SCRIPT_FILE%.*}"
ENC="${SCRIPT_NAME%-*}"
@wrzlbrmft
wrzlbrmft / zip4aws-eb-node.sh
Created March 29, 2016 13:52
Creates a zip file of a Node.js app to be deployed to AWS Elastic Beanstalk.
#!/usr/bin/env sh
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
PROJECT_NAME="$(cat "$PROJECT_ROOT/src/package.json" | grep '"name"' | cut -d\" -f4)"
PROJECT_VERSION="$(cat "$PROJECT_ROOT/src/package.json" | grep '"version"' | cut -d\" -f4)"
rsync -vrLkpogt --delete-before --progress \
--exclude .DS_Store \
--exclude build \
@wrzlbrmft
wrzlbrmft / list-sshd-logins.txt
Created March 29, 2016 11:53
List IPs/encounters or hostnames of invalid/accepted logins to sshd.
### invalid logins
# journalctl (last 7 days)
journalctl --since -7d | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq -c
journalctl --since -7d | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq | xargs -n1 dig +short -x
# /var/log/auth.log
cat /var/log/auth.log | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq -c
cat /var/log/auth.log | grep 'sshd.*Invalid' | awk '{ print $10 }' | sort | uniq | xargs -n1 dig +short -x
@wrzlbrmft
wrzlbrmft / check-string.sh
Created March 29, 2016 11:50
Check a URL for a string and send an e-mail if found.
#!/bin/sh
CHECK_URL="https://store.google.com/"
CHECK_STRING="Nexus 5"
MAIL_TO="mail@example.org"
MAIL_SUBJECT="$CHECK_STRING"
MAIL_BODY="$CHECK_URL"
COUNT="$(curl -Ls "$CHECK_URL" | grep -c "$CHECK_STRING")"
@wrzlbrmft
wrzlbrmft / list-files.txt
Last active May 23, 2017 17:16
List files and their sizes or md5 checksums.
# sizes
find . -type f -printf "%p %s\n" | sort
# md5 checksums
find . -type f -exec md5sum "{}" \; | awk '{ print $2,$1 }' | sort
@wrzlbrmft
wrzlbrmft / git-all.sh
Created March 29, 2016 11:43
Do a git pull and status in all direct subdirectories being Git repos.
#!/usr/bin/env sh
_IFS="$IFS"
IFS=$'\n'
for i in $(find . -mindepth 1 -maxdepth 1 -type d | sort); do
if [ -d "$i/.git" ]; then
printf "$i: "
cd "$i"
@wrzlbrmft
wrzlbrmft / smoother-font-rendering-alarm.txt
Created February 14, 2016 13:50
Simple way for smoother font rendering under Arch Linux ARM.
# ~/.Xresources
Xft.autohint: 0
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.lcdfilter: lcdlight
@wrzlbrmft
wrzlbrmft / gimp-snap-to-canvas-edges.txt
Created February 2, 2016 20:41
GIMP: Enable "Snap to Canvas Edges" for all images by default.
# ~/.gimp-*/gimprc
(default-snap-to-canvas yes)
@wrzlbrmft
wrzlbrmft / self-signed-ssl-cert.txt
Created January 7, 2016 17:03
Create a self-signed SSL certificate.
# see https://wiki.archlinux.org/index.php/Apache_HTTP_Server#TLS.2FSSL
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:4096 -out server.key
chmod 400 server.key
openssl req -new -sha256 -key server.key -out server.csr
openssl x509 -req -days 1095 -in server.csr -signkey server.key -out server.crt