Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Ajnasz / znvm.zsh
Last active February 16, 2020 14:00
https://github.com/Ajnasz/znvm
#!/usr/bin/env python3
"""
Copy flickr photos to folder
options:
-s upload to s3, not you will need to set AWS_SECRET_ACCESS_KEY
AWS_ACCESS_KEY_ID and ENDPOINT_URL environment variables if you want to do
this
-d directoryName The directory where the photos listed
"""
@Ajnasz
Ajnasz / git-ver
Created September 29, 2019 11:54
#!/bin/sh
VERSION="$1"
if [ -z "$VERSION" ];then
echo "Version argument is mandantory" >&2
exit 1
fi
if expr "$VERSION" : "^v[0-9]\+\.[0-9]\+\.[0-9]\+" >/dev/null;then
#!/usr/bin/env python2
# Python script to generate TOTP qrcodes from keepass database to scan into
# authenticator app
# Required libraries:
# https://github.com/lincolnloop/python-qrcode
# https://github.com/pschmitt/pykeepass
from pykeepass import PyKeePass
import qrcode
import os
#!/bin/sh
PATH_TO_ACCOUNT="/path/to/account"
PATH_TO_FILE="/path/to/file"
ACCOUNT_NAME="account@somewhere.org"
ISSUER="Somewhere Org"
KEEPASS_PASSWORD="the secret password"
echo "$KEEPASS_PASSWORD" | keepassxc-cli show -a "TOTP Seed" "$PATH_TO_FILE" "$PATH_TO_ACCOUNT" | grep -v "Insert password" | while read i;do echo "otpauth://totp/$ACCOUNT_NAME?secret=$i&issuer=$ISSUER" | qr;done;
#!/bin/sh
# pomodoro.sh to play a sound after pomodoro finished
# set update frequency to 0 to don't display updates
# In that case send a USR1 signal to the process if you want to see the elapsed time
# The script will update you slack status if slack token set
# You can set slack token by setting the SLACK_TOKEN env var
# Or put the token into a gpg encrypted file to $HOME/.secret/slack_token.gpg
# You can override that path by setting the SLACK_TOKEN_FILE_PATH env var
@Ajnasz
Ajnasz / pre-commit
Last active April 14, 2018 11:03 — forked from jhartikainen/commit-msg
ESLint git commit hook
#!/bin/sh
files=$(git diff --diff-filter ACMR --cached --name-only | grep '\.js$')
FAILED=0
for file in $files; do
git show :$file | $(npm bin)/eslint --stdin --stdin-filename $file
EXIT_CODE=$?
#!/bin/sh
# get clues
grep CLUE crimescene
# clue mentioned Annabel
grep Annabel people | \
cut -s -f 4 | \
cut -d ' ' -f1-2,4 | \
sed 's/ /_/' | \
@Ajnasz
Ajnasz / README.md
Last active May 19, 2018 19:52
Download stuff from humble-bundle in batch
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".