Skip to content

Instantly share code, notes, and snippets.

@pstorch
pstorch / mv-photos.sh
Created August 27, 2023 13:38
Move .jpg files to subdirectory by date
#!/bin/bash
for x in *.jpg; do
d=$(date -r "$x" +%Y-%m-%d)
mkdir -p "./$d"
mv -- "$x" "./$d/"
done
@pstorch
pstorch / access_not_found.log
Created January 7, 2023 09:27
URLs from access log which are not found
GET /.env
GET /.sts.php
GET /.svn
GET /1index.php
GET /1index.php?f=
GET /2index.php
GET /2index.php?f=
GET /3index.php
GET /3index.php?f=
GET /2018/wp-includes/wlwmanifest.xml
@pstorch
pstorch / mount.sh
Created February 9, 2020 21:33
Mounts
# mount overlay filesystem
sudo mount -t aufs -o br=/var/rsapi-test-photos:/media/peter/Backup/railway-stations.org/fotos none /tmp/railway-station-photos
# mount webdav
sudo mount -t davfs davs://cloud.railway-stations.org/remote.php/webdav/RSAPI-Test /home/peter/rsapi-test
@pstorch
pstorch / rsapi.sql
Created January 12, 2020 11:32
RSAPI DB Queries
-- photographers by number of countries
SELECT u.name, count(distinct countrycode) as countries FROM `photos` p join users u on u.id = p.photographerid group by photographerid order by count(distinct countrycode) desc
@pstorch
pstorch / .zshrc
Created September 19, 2018 20:24
Git fetch pull request
git_fetch_pull_request() {
git fetch origin refs/pull/$1/head:pr/$1
git checkout pr/$1
}
alias gpr='git_fetch_pull_request'
@pstorch
pstorch / cgeodb.sh
Created January 6, 2017 22:32
Get sqlite file from android app via adb (non root), example for cgeo app
#!/bin/sh
adb -d shell "run-as cgeo.geocaching cp /data/data/cgeo.geocaching/databases/data /sdcard/cgeo.sqlite"
adb pull /sdcard/cgeo.sqlite
@pstorch
pstorch / schemacrawler2svg.sh
Created January 4, 2017 14:10
SchemaCrawler svg output
#!/bin/sh
#https://github.com/sualeh/SchemaCrawler
./schemacrawler.sh -c=graph -url=jdbc:sqlite:cgeo.sqlite -loglevel=CONFIG -infolevel=detailed -u=cgeo -outputformat=svg
:w !sudo tee %

Keybase proof

I hereby claim:

  • I am pstorch on github.
  • I am peterstorch (https://keybase.io/peterstorch) on keybase.
  • I have a public key whose fingerprint is 954B A42D D4F4 E077 17D5 0400 1199 A722 4849 EA65

To claim this, I am signing this object:

@pstorch
pstorch / findInFiles.sh
Created June 27, 2016 11:17
find a text in files recursively
grep --include=\*.java -rnw . -e "pattern"