all repos — dotfiles @ 0a55cd8663268a0bdb1d9044c28733921ab87885

linux dotfiles

add new scripts

ix - ix uploader
nping - using ping with custom o/p
reload-browser
touchpad-conf - configs touchpad (libinput)
Prithu Goswami prithugoswami524@gmail.com
Tue, 29 Oct 2019 13:29:30 +0530
commit

0a55cd8663268a0bdb1d9044c28733921ab87885

parent

82f1e23836996f86bbb14f0b8bb297276ede6ce9

4 files changed, 93 insertions(+), 0 deletions(-)

jump to
A bin/scripts/ix

@@ -0,0 +1,13 @@

+#!/bin/sh + +# upload text to ix.io + +PASTE() { + curl -F 'f:1=<-' ix.io +} + +if test -z "$1"; then + cat - | PASTE +else + cat "$1" | PASTE +fi
A bin/scripts/nping

@@ -0,0 +1,21 @@

+#!/usr/bin/sh + + +if [[ $1 = "l" ]]; then + while [ 1 ]; do + ping -c 1 1.1.1.1 | awk 'NR==2 {print $(NF-1) " " $NF}' | + cut -d '=' -f2 + if [[ $2 -ne 0 ]]; then + sleep $2 + else + sleep 1 #default loop sleep + fi + done +elif [[ $1 = "ll" ]]; then + while [ 1 ]; do + ping -c 1 1.1.1.1 | awk 'NR==2 {print $(NF-1) " " $NF}' | + cut -d '=' -f2 + done; +else + ping -c 1 1.1.1.1 | awk 'NR==2 {print $(NF-1) " " $NF}' | cut -d '=' -f2 +fi
A bin/scripts/reload-browser

@@ -0,0 +1,47 @@

+#!/bin/sh +# reload-browser - A cross-platform wrapper for reloading the current +# browser tab +# Eric Radman, 2014 +# http://eradman.com/entrproject/scripts/ + +usage() { + case `uname` in + Darwin) + # applescript needs the exact title + echo "Usage: $(basename $0) Firefox [Safari \"Google Chrome\" ...]" + ;; + *) + # xdotool uses regular expressions + echo "Usage: $(basename $0) Firefox [Chrome ...]" + ;; + esac + exit 1 +} +[ $# -lt 1 ] && usage + +active=$(xdotool getactivewindow) + +for app in "$@" +do + case `uname` in + Darwin) + /usr/bin/osascript <<-APPLESCRIPT + set prev to (path to frontmost application as text) + tell application "$app" + activate + end tell + delay 0.5 + tell application "System Events" to keystroke "r" using {command down} + delay 0.5 + activate application prev + APPLESCRIPT + ;; + *) + xdotool search --onlyvisible --class "$app" windowfocus key \ + --window %@ 'ctrl+r' || { + 1>&2 echo "unable to signal an application named \"$app\"" + } + xdotool windowfocus --sync ${active} + ;; + esac +done
A bin/scripts/touchpad-conf

@@ -0,0 +1,12 @@

+#!/usr/bin/bash +# very ugly, I know + +id=$(xinput | grep -i touchpad | grep -o "id=[0-9]*" | grep -o "[0-9]*") +tapen=$(xinput list-props $id | grep "Tapping Enabled" |\ + awk 'NR==1 {print $(NF-1)}' | cut -d '(' -f 2 | cut -d ')' -f 1) +natscr=$(xinput list-props $id | grep "Natural Scrolling" |\ + awk 'NR==1 {print $(NF-1)}' | cut -d '(' -f 2 | cut -d ')' -f 1) + +xinput set-prop $id $tapen 1 +xinput set-prop $id $natscr 1 +