scripts

random scripts
git clone git://parazyd.org/scripts.git
Log | Files | Refs

commit b88d0198830d2514763a78c625538fd3ee153a41
parent f9a20549f30de972fa5a7522b00a5637f3ca05ee
Author: parazyd <parazyd@dyne.org>
Date:   Sun, 18 Feb 2018 00:59:45 +0100

some more scripts

Diffstat:
Mautoup | 9+++++++--
Mff | 6+-----
Ahex-contrast.py | 37+++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/autoup b/autoup @@ -1,6 +1,6 @@ #!/bin/sh server=parazyd.cf -webroot=/home/parazyd/public_html/pub.parazyd.cf +webroot=/home/parazyd/public_html/parazyd.cf/pub webdir=dev/random case "$1" in @@ -11,6 +11,11 @@ case "$1" in -n) shift webdir=dev/null + ;; + -f) + shift + webdir=tmp/photo + ;; esac @@ -45,4 +50,4 @@ esac scp "$1" "${server}:${webroot}/${webdir}/${filename}" || exit 1 echo "https://$server/pub/$webdir/$filename" -echo "gopher://$server/$goph/pub/dev/random" +echo "gopher://$server/$goph/pub/$webdir/$filename" diff --git a/ff b/ff @@ -1,6 +1,2 @@ #!/bin/sh - -ff=/usr/bin/firefox -exec $ff -no-remote -ProfileManager "$@" - -#sudo -u ff firefox -no-remote -ProfileManager +xhost si:localuser:ff && sudo -u ff firefox -no-remote -ProfileManager "$@" diff --git a/hex-contrast.py b/hex-contrast.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# Spit out contrast of given stdin hex value(s) +# One value per line. + +from sys import stdin + +hexmap = { + '#': '#', + '0': 'f', + '1': 'e', + '2': 'd', + '3': 'c', + '4': 'b', + '5': 'a', + '6': '9', + '7': '8', + '8': '7', + '9': '6', + 'a': '5', + 'b': '4', + 'c': '3', + 'd': '2', + 'e': '1', + 'f': '0', +} + +args = stdin.read().split('\n') + +out = [] +for i in args: + val = '' + for j in i: + val += hexmap[j.lower()] + out.append(val) + +for i in out: + print(i)