tsome more scripts - scripts - random scripts
 (HTM) git clone git://parazyd.org/scripts.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit b88d0198830d2514763a78c625538fd3ee153a41
 (DIR) parent f9a20549f30de972fa5a7522b00a5637f3ca05ee
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Sun, 18 Feb 2018 00:59:45 +0100
       
       some more scripts
       
       Diffstat:
         M autoup                              |       9 +++++++--
         M ff                                  |       6 +-----
         A hex-contrast.py                     |      37 +++++++++++++++++++++++++++++++
       
       3 files changed, 45 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/autoup b/autoup
       t@@ -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
       t@@ -11,6 +11,11 @@ case "$1" in
                -n)
                        shift
                        webdir=dev/null
       +                ;;
       +        -f)
       +                shift
       +                webdir=tmp/photo
       +                ;;
        esac
        
        
       t@@ -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"
 (DIR) diff --git a/ff b/ff
       t@@ -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 "$@"
 (DIR) diff --git a/hex-contrast.py b/hex-contrast.py
       t@@ -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)