Skip to content

Instantly share code, notes, and snippets.

View sandrotanner's full-sized avatar
🌆

Sandro Tanner sandrotanner

🌆
  • 16:25 (UTC +02:00)
View GitHub Profile
@sandrotanner
sandrotanner / Log program output to syslog and custom file (with custom syslog tag)
Last active March 26, 2024 09:51
Log program output to syslog and custom file (with custom syslog tag)
myscript.sh 2>&1 | logger -s -t MYLABEL 2>> log.log
@sandrotanner
sandrotanner / old-commit.sh
Last active March 26, 2024 09:58
checkout 14 days old commit
#!/usr/bin/env sh
git checkout "$(git rev-list -1 --before=14.days.ago main)"
gs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress corrupted.pdf

If even that failes then Okular can probably still open it and print to PDF file.

@sandrotanner
sandrotanner / find-users-who-dont-own-any-files.sh
Created April 2, 2020 05:59
find-users-who-dont-own-any-files
#!/bin/bash
cut -f 1 -d : /etc/passwd | \
while read i; do find / -user "$i" | grep -q . || echo "$i"; done

deletes all local branches that are merged into master

git branch | grep -v '^*' | xargs git branch -d

use uppercase -D to force delete also branches that haven't been merged.