Skip to content

Instantly share code, notes, and snippets.

View schnapster's full-sized avatar
🔥

Dennis Neufeld schnapster

🔥
View GitHub Profile
@schnapster
schnapster / hoff.sh
Last active March 8, 2024 14:10
David Hasselhoff straight to your Wallpaper
#!/bin/bash
WORK_DIR=/tmp
curl -s https://gist.githubusercontent.com/schnapster/4a07648b28c63faac51955549b520b24/raw/thehoff.jpg -o "$WORK_DIR/thehoff.jpg"
# Every Friday at 11:05
(crontab -l ; echo "5 11 * * 5 open https://www.youtube.com/watch?v=dQw4w9WgXcQ") | sort - | uniq - | crontab -
osascript <<END
tell application "Finder"
@schnapster
schnapster / gitlab_contributions
Created September 17, 2019 13:31
Gitlab total number of contributions
See: https://gitlab.com/gitlab-org/gitlab-foss/issues/47320#note_155771303
Just drop it into the console when on a profile.
javascript:alert(`${Array.from(document.querySelectorAll('rect.user-contrib-cell')).reduce((sum, node) => sum + (parseInt((node.getAttribute('title') || node.getAttribute('data-original-title') || '').split(' ')[0]) || 0), 0)} contributions in the last 12 mo.`);
@schnapster
schnapster / grafana_b2_backup.sh
Last active June 23, 2024 16:35
Backup Grafana sqlite db to Backblaze
#!/bin/bash
#
# Prerequisites:
# sudo apt install pipx curl jq tar sqlite3
# sudo pipx install b2
#
# pass 4 args:
# - instance (meta information), example: <machine name>
# - b2 bucket name (target of the upload), example: grafana-backups
# - path to backblaze credentials file that sets B2_ACCOUNT_ID and B2_APP_KEY
@schnapster
schnapster / prometheus_b2_backup.sh
Last active June 23, 2024 16:35
Backup Prometheus v2.1+ snapshots to b2 backblaze. Requires b2, curl, jq, tar
#!/bin/bash
#
# Prerequisites:
# sudo apt install pipx curl jq tar
# sudo pipx install b2
#
# Enabled admin api in your prometheus, see: https://prometheus.io/docs/prometheus/2.1/querying/api/#tsdb-admin-apis
#
# pass 6 args:
# - prometheus base url, example: http://localhost:9090
@schnapster
schnapster / LAVALINK_CONCEPTS_DRAFT.md
Last active June 9, 2018 15:19
Lavalink Concepts Draft NOT DONE YET
@schnapster
schnapster / Dockerfile
Last active July 17, 2018 12:50
Teamcity agent docker image with Java 10 and docker-compose
FROM jetbrains/teamcity-agent
RUN apt update && apt install wget && \
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" \
http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz && \
tar -xvf jdk-10.0.1_linux-x64_bin.tar.gz && \
rm jdk-10.0.1_linux-x64_bin.tar.gz && \
mkdir -p /usr/lib/jvm/jdk-10 && \
mv jdk-10*/* /usr/lib/jvm/jdk-10/ && \
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-10/bin/java" 1020 && \
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-10/bin/javac" 1020 && \
@schnapster
schnapster / learn these shortcuts for idea
Created January 25, 2018 11:14
learn these shortcuts for idea
learn these shortcuts for idea
move editor:
ctrl + up/down
move line/block in editor:
ctrl + shift + up/down
see things/general shortcuts:
ctrl + e / double shift / ctrl + shift + a
@schnapster
schnapster / pg_b2_backup.sh
Created January 21, 2018 15:56
Backup postgres database to backblaze b2
#!/bin/bash
# this requires the backblaze CLI tool to be installed (pip install b2)
# pass 4 args:
# - database name (needs to exist in postgres)
# - app name (meta information)
# - bucket name (target of the upload)
# - file containing b2 credentials (it will be sourced and needs to set B2_ACCOUNT_ID and B2_APP_KEY)
#
# example: ./pg_b2_backup.sh db app backups-daily ~/b2_creds
@schnapster
schnapster / pgadmin4_setup.md
Last active May 9, 2020 23:47
Set up pgAdmin4 on a recent Ubuntu type system

Set up pgAdmin4 on a recent Ubuntu type system

Adjust paths according to your preferences

Requirements:

sudo apt install python2.7-dev virtualenv python-pip libpq-dev

Keybase proof

I hereby claim:

  • I am schnapster on github.
  • I am napster (https://keybase.io/napster) on keybase.
  • I have a public key ASDfJ9HNv3Z5MrJ7H1VP4eI-FewxEYZQlGx6ClyNmQ0fMgo

To claim this, I am signing this object: