diff options
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | gallery | 22 | ||||
-rwxr-xr-x | icalbuddy | 8 | ||||
l--------- | luakit-adblock-update | 1 | ||||
-rwxr-xr-x | openvpn-resolv-conf | 46 | ||||
-rwxr-xr-x | powersaving | 35 | ||||
-rwxr-xr-x | sri-hash | 34 | ||||
-rwxr-xr-x | weather-forecast | 36 | ||||
-rwxr-xr-x | weather-query | 40 | ||||
-rwxr-xr-x | wifi | 16 | ||||
-rwxr-xr-x | youtube-player | 18 |
11 files changed, 2 insertions, 257 deletions
@@ -1,3 +1,4 @@ # Misc scripts -This is an assorted collection of simple scripts to be available on `$PATH`. +This repository is used as an assorted collection of simple scripts to be +available on `$PATH`. diff --git a/gallery b/gallery deleted file mode 100755 index 45e46eb..0000000 --- a/gallery +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Image galleries: a wrapper for sxiv(1). -# - -# Parameters -BASENAME="`basename $0`" -IMAGES="$HOME/data/images" -GALLERY="${1:-$IMAGES}" - -# Check -if [ "$GALLERY" != "-" ] && [ ! -d "$GALLERY" ]; then - echo "$BASENAME: path not found: $GALLERY" - exit 1 -elif ! which sxiv &> /dev/null; then - echo "$BASENAME: please install sxiv" - exit 1 -fi - -# Dispatch -# Option -o allows piping the selection output to other tools -sxiv -t -q -b -o -r $GALLERY 2> /dev/null diff --git a/icalbuddy b/icalbuddy deleted file mode 100755 index d9e048d..0000000 --- a/icalbuddy +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# -# This is a placeholder command so xcal does not give errors when calling icalbuddy -# See https://github.com/alxppp/xcal -# http://hasseg.org/icalBuddy/ - -# Do nothing, successfully -/bin/true diff --git a/luakit-adblock-update b/luakit-adblock-update deleted file mode 120000 index 42263c4..0000000 --- a/luakit-adblock-update +++ /dev/null @@ -1 +0,0 @@ -/home/rhatto/.config/luakit/contrib/luakit-plugins/tools/adblock-update.sh
\ No newline at end of file diff --git a/openvpn-resolv-conf b/openvpn-resolv-conf deleted file mode 100755 index 8c525cd..0000000 --- a/openvpn-resolv-conf +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# Parses DHCP options from OpenVPN to update resolv.conf. -# To use set as 'up' and 'down' script in your openvpn config: -# up /etc/openvpn/update-resolv-conf -# down /etc/openvpn/update-resolv-conf -# -# credit: -# * Thomas Hood <jdthood@yahoo.co.uk> -# * Chris Hanson -# * chlauber@bnc.ch -# -# Licensed under the GNU GPL - -[ -x /sbin/resolvconf ] || exit 0 - -case $script_type in - up) - for optionname in ${!foreign_option_*} ; do - option="${!optionname}" - echo $option - part1=$(echo "$option" | cut -d " " -f 1) - if [ "$part1" == "dhcp-option" ] ; then - part2=$(echo "$option" | cut -d " " -f 2) - part3=$(echo "$option" | cut -d " " -f 3) - if [ "$part2" == "DNS" ] ; then - IF_DNS_NAMESERVERS="$IF_DNS_NAMESERVERS $part3" - fi - if [ "$part2" == "DOMAIN" ] ; then - IF_DNS_SEARCH="$part3" - fi - fi - done - R="" - if [ "$IF_DNS_SEARCH" ] ; then - R="${R}search $IF_DNS_SEARCH\n" - fi - for NS in $IF_DNS_NAMESERVERS ; do - R="${R}nameserver $NS" - done - echo -n "$R" | /sbin/resolvconf -a "${dev}.inet" - ;; - down) - /sbin/resolvconf -d "${dev}.inet" - ;; -esac diff --git a/powersaving b/powersaving deleted file mode 100755 index 75c5605..0000000 --- a/powersaving +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# from https://geoff.greer.fm/2017/07/16/thinkpad-x62/ - -# Disable the NMI watchdog -echo '0' > '/proc/sys/kernel/nmi_watchdog'; - -# Runtime power management for I2C devices -for i in /sys/bus/i2c/devices/*/device/power/control ; do - echo auto > ${i} -done - -# Runtime power-management for PCI devices -for i in /sys/bus/pci/devices/*/power/control ; do - echo auto > ${i} -done - -# Runtime power-management for USB devices -for i in /sys/bus/usb/devices/*/power/control ; do - echo auto > ${i} -done - -# Low power SATA -for i in /sys/class/scsi_host/*/link_power_management_policy ; do - echo min_power > ${i} -done - -# Disable Wake-on-LAN on ethernet port -#ethtool -s wlan0 wol d; -#ethtool -s eth0 wol d - -#Enable Audio codec power management -echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'; - -# Low power wireless -iw dev wlan0 set power_save on diff --git a/sri-hash b/sri-hash deleted file mode 100755 index 5979c39..0000000 --- a/sri-hash +++ /dev/null @@ -1,34 +0,0 @@ -#/bin/sh -# -# SRI Hash Generator -# - -# Parameters -BASENAME="`basename $0`" -URI="$1" - -# Check -if [ -z "$URI" ]; then - echo "usage: $BASENAME <file-or-url>" - exit 1 -fi - -# Get file -if echo "$URI" | grep -q '^http'; then - echo "downloading $URI and generating hash..." - HASH="`curl $URI | openssl dgst -sha384 -binary | openssl base64 -A`" - echo "" -else - if [ -e "$URI" ]; then - # See https://www.srihash.org/ - HASH="`openssl dgst -sha384 -binary $URI | openssl base64 -A`" - else - echo "file not found: $URI" - exit 1 - fi -fi - -# Generate -cat <<EOF -<script src="$URI" integrity="sha384-$HASH" crossorigin="anonymous"></script> -EOF diff --git a/weather-forecast b/weather-forecast deleted file mode 100755 index 269f740..0000000 --- a/weather-forecast +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# Simple wrapper around wttr.in -# - -# Parameters -BASENAME="`basename $0`" -PROGRAM="$1" -CACHE="$HOME/.local/share/weather" - -# Load config -source $HOME/.custom/wttr.in.conf || exit 1 - -# weather-forecast service query -function weather_forecast_query { - # Make sure everything we need exists - mkdir -p $CACHE - touch $CACHE/weather-forecast.cur $CACHE/weather-forecast.prev - - # Save the previous forecast - cp $CACHE/weather-forecast.cur $CACHE/weather-forecast.prev - curl wttr.in/$LOCATION > $CACHE/weather-forecast.cur 2> /dev/null - - # Test if current forecast is empty, meaning - # that we're probably ofline. In that case - # we provide the previous output. - if [ ! -s "$CACHE/weather-forecast.cur" ]; then - cp $CACHE/weather-forecast.prev $CACHE/weather-forecast.cur - fi - - # Display output - cat $CACHE/weather-forecast.cur -} - -# Main -weather_forecast_query diff --git a/weather-query b/weather-query deleted file mode 100755 index f834415..0000000 --- a/weather-query +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# Simple wrapper around brweather -# - -# Parameters -BASENAME="`basename $0`" -PROGRAM="$1" -CACHE="$HOME/.local/share/weather" - -# Command line args -shift - -# Weather service query -function weather_query { - # Make sure everything we need exists - mkdir -p $CACHE - touch $CACHE/weather.cur $CACHE/weather.prev - - # Save the previous forecast - cp $CACHE/weather.cur $CACHE/weather.prev - weather $* > $CACHE/weather.cur 2> /dev/null - - # Test if current forecast is empty, meaning - # that we're probably ofline. In that case - # we provide the previous output. - if [ ! -s "$CACHE/weather.cur" ]; then - cp $CACHE/weather.prev $CACHE/weather.cur - fi - - # Display output - cat $CACHE/weather.cur -} - -# Main -if [ "$PROGRAM" == 'brweather' ]; then - brweather $* | grep -v 'Erro.' -else - weather_query -fi @@ -1,16 +0,0 @@ -#!/bin/bash -# -# Wifi initializer -# - -#DEVICE="ath0" -DEVICE="wlan0" - -if [ ! -z "$1" ]; then - read -sp "Enter the WPA passphrase: " PASS - echo "" - wpa_passphrase $1 $PASS -elif [ -f "wpa_supplicant.conf" ]; then - sudo wpa_supplicant -B -Dwext -i$DEVICE -cwpa_supplicant.conf - sudo dhclient $DEVICE -fi diff --git a/youtube-player b/youtube-player deleted file mode 100755 index 46b8dd5..0000000 --- a/youtube-player +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# -# Youtube player from the command line -# https://unix.stackexchange.com/questions/160212/watch-youtube-videos-in-terminal -# - -# Parameters -BASENAME="`basename $0`" -URL="$1" - -# Check -if [ -z "$1" ]; then - echo "usage: $BASENAME <url>" - exit 1 -fi - -# Run -youtube-dl $URL -o - | mplayer -vo aa -monitorpixelaspect 0.5 - |