diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..038d718 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +testing diff --git a/bonfetch.sh b/bonfetch.sh new file mode 100755 index 0000000..648fea9 --- /dev/null +++ b/bonfetch.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +color=$'\e[36m\e'$'[1m' +base=$'\e[(B'$'\e[90m' + +insline () { + sed "$1s/$/ $2/" +} + +insloop () { + line=$1 + file=$2 + shift 2 + line=$(($line-$#+1)) + for text in "$@" + do + cat $file | sed "$(echo $line)s/$/ $color$text$base/" > $file + line=$(($line+1)) + done +} + +distro=$(lsb_release -i | awk '{print $3}' | tr '[:upper:]' '[:lower:]') +kern=$(uname -r | sed 's/\-.*//;') +res=$(xrandr --current | grep ' connected' | sed 's/\+.*//;s/.* //;') +shell=$(basename $SHELL) +wmid=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK | sed 's/.*\s//;') +wm=$(xprop -id "$wmid" -notype -len 100 -f _NET_WM_NAME 8t | grep 'WM_NAME' | sed 's/\"//g;s/.*\s//') +model=$(cat /sys/devices/virtual/dmi/id/product_version) +upt=$(cat /proc/uptime | sed 's/\..*//') +days=$(echo $(( $upt / 60 / 60 / 24 ))d ) +hours=$(echo $(( $upt / 60 / 60 % 24 ))h ) +minutes=$(echo $(( $upt / 60 % 60 ))m ) +pkgs_aur=$(pacman -Qqm | wc -l) +pkgs_total=$(pacman -Qq | wc -l) +wifi_quality=$(nmcli -f IN-USE,BARS device wifi list | awk '/*/ {print $2}') + +TREEFILE=/tmp/bonfetch.txt +bonsai.sh --termcolors --life 15 --multiplier 10 --base 2 --geometry 20,200 | sed 1,8d > $TREEFILE + +insloop $(cat $TREEFILE | wc -l) $TREEFILE "distro: $distro" "kernel: $kern" "resolution: $res"\ + "shell: $shell" "wm: $wm" "uptime: $days $hours $minutes" "packages: $pkgs_total (aur: $pkgs_aur)" "wifi: $wifi_quality" +clear +cat $TREEFILE | sed '/^\s*$/d' +rm $TREEFILE diff --git a/exif-notify.sh b/exif-notify.sh new file mode 100755 index 0000000..ae5e72a --- /dev/null +++ b/exif-notify.sh @@ -0,0 +1,2 @@ +#!/bin/bash +dunstify "EXIF Data" "$(exiftool -q -p ~/.scripts/notify-exif.fmt $@)" diff --git a/f16.py b/f16.py new file mode 100755 index 0000000..e34ade7 --- /dev/null +++ b/f16.py @@ -0,0 +1,14 @@ +#!/bin/python3.8 + +import sys + +def f16(data): + s1, s2 = 0, 0 + + for item in range(0, len(data)): + s1 = (s1 + ord(data[item])) % 255 + s2 = (s1 + s2) % 255 + + return( hex(s2 << 8 | s1)[2:].zfill(4) ) + +print(f16(sys.argv[1])) diff --git a/flowerfetch.sh b/flowerfetch.sh new file mode 100755 index 0000000..dc8a633 --- /dev/null +++ b/flowerfetch.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +leaf=$'\e[38;5;82m' +stem=$'\e[38;5;70m' +ground=$'\e[38;5;130m' +stamen=$'\e[38;5;226m' +flower=$'\e[38;5;231m' + +truered=$'\e[38;5;160m' +truegrn=$'\e[38;5;82m' + +white=$'\e[0m' +c1=$'\e[31m' +c4=$'\e[34m' +c6=$'\e[36m' +c7=$'\e[37m' + +bats=() +for battery in /sys/class/power_supply/BAT*; +do + baticon="" + batstat=$(cat $battery/status) + if [ $batstat == "Discharging" ] + then + baticon="$trueredâ–Ľ " + elif [ $batstat == "Charging" ] + then + baticon="$truegrnâ–˛ " + fi + bats+=("[ $(basename $battery) $(cat $battery/capacity)% $baticon$c7]") +done + +distro=$(lsb_release -si) +kern=$(uname -r | sed 's/\-.*//;') +res=$(xrandr --current | grep ' connected' | sed 's/\+.*//;s/.* //;') +shell=$(basename $SHELL) +wmid=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK | sed 's/.*\s//;') +wm=$(xprop -id "$wmid" -notype -len 100 -f _NET_WM_NAME 8t | grep 'WM_NAME' | sed 's/\"//g;s/.*\s//') +model=$(cat /sys/devices/virtual/dmi/id/product_version) +upt=$(cat /proc/uptime | sed 's/\..*//') +days=$(echo $(( $upt / 60 / 60 / 24 ))d ) +hours=$(echo $(( $upt / 60 / 60 % 24 ))h ) +minutes=$(echo $(( $upt / 60 % 60 ))m ) +pkgs_aur=$(pacman -Qqm | wc -l) +pkgs_total=$(pacman -Qq | wc -l) +#pkgs_native=$(pacman -Qqn | wc -l) +#pkgs_total=$(($pkgs_native + $pkgs_aur)) +wifi_quality=$(nmcli -f IN-USE,BARS device wifi list | awk '/*/ {print $2}') + +tput clear +cat << EOF +$flower _ _ + (_\\_) + (_ $stamen<_{}$flower + (_/_) +$leaf |\\ $stem|$leaf + \\\\$stem|$leaf /| + \\$stem|$leaf// + $stem|$leaf/ +$ground,.,.,$stem|$ground.,.,.$c4 +model $white-$c7 $model $c6 +distro $white-$c7 $distro $c4 +kernel $white-$c7 $kern $c6 +wm $white-$c7 $wm $c4 +res $white-$c7 $res $c6 +shell $white-$c7 $shell $c4 +uptime $white-$c7 $days $hours $minutes $c6 +bat $white-$c7 ${bats[*]} $c4 +pkgs $white-$c7 $pkgs_total (AUR: $pkgs_aur) $c6 +wifi $white-$c7 $wifi_quality + +EOF diff --git a/get_calibration_profiles.sh b/get_calibration_profiles.sh new file mode 100755 index 0000000..4a02a00 --- /dev/null +++ b/get_calibration_profiles.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +icc_file_location="/home/$(whoami)/Docs/display/" +icc_list=$(find $icc_file_location -maxdepth 1 -name '*icc' -printf '%f\n' -o -name '*icm' -printf '%f\n' | sed "$ a Default" ) +icc_amount=$(echo $icc_list | wc -w) + +if [ "$icc_amount" -lt 2 ]; then + notify-send "No .icc files found in $icc_file_location" + exit 1 +fi + +choice=$(echo $icc_list | rofi -mesg 'Select your ICC.' -sep ' ' -dmenu) +display_list=$(xrandr | rg 'Screen' | sed -E 's/:(.*)//;s/(.*) //') +choice2=$(echo $display_list | rofi -mesg 'Select your panel.' -dmenu) + +if [[ $choice == "Default" ]]; then + xcalib -s $choice2 -c +else + xcalib -s $choice2 $icc_file_location$choice +fi diff --git a/get_updates.sh b/get_updates.sh new file mode 100755 index 0000000..71b37a7 --- /dev/null +++ b/get_updates.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +updates=/tmp/update_list.txt + +checkupdates > $updates +notify-send -t 60000 "$(cat $updates | wc -l) packages that require updating..." "$(cat $updates | sed 's/ .*//g')" +rm $updates diff --git a/imv-exif.fmt b/imv-exif.fmt new file mode 100644 index 0000000..ac3d1cb --- /dev/null +++ b/imv-exif.fmt @@ -0,0 +1 @@ +${make;s/ .*//} $model + $lensid f/$fnumber ${shutterspeed}s ISO$iso ${focallength;s/ .*//}mm $directory/$filename $megapixels MP ($imagesize) diff --git a/mping.sh b/mping.sh new file mode 100755 index 0000000..2877393 --- /dev/null +++ b/mping.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +mp () { + echo "$1 - "$(ping -c5 $1 | sed -En 's/.*time=//g;s/ ms/ms/g;2,6p') +} + +export -f mp + +parallel mp {} ::: $@ | column --table diff --git a/notify-exif.fmt b/notify-exif.fmt new file mode 100644 index 0000000..eb69081 --- /dev/null +++ b/notify-exif.fmt @@ -0,0 +1,4 @@ +${make;s/ .*//} $model + $lensmodel +f/$fnumber ${shutterspeed}s ISO$iso ${focallength;s/ .*//}mm +$directory/$filename +$megapixels MP ($imagesize) diff --git a/pianobar_lyrics.sh b/pianobar_lyrics.sh new file mode 100755 index 0000000..4d5d4de --- /dev/null +++ b/pianobar_lyrics.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +DATA=() + +format () { + echo $* | tr ' ' '-' +} + +while read LINE; do + DATA+=("$LINE") +done < /tmp/pianobar_info + + +ARTIST=${DATA[1]} +SAFE_ARTIST=$(format $ARTIST) +TITLE=${DATA[0]} +SAFE_TITLE="$(format $TITLE)" +ALBUM=${DATA[2]} + +if [[ `wget -S --spider "https://makeitpersonal.co" 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then + +LYRICS=$(wget --user-agent="Mozilla/5.0 Gecko/20100101" --no-check-certificate --quiet --timeout=10 -O - "https://makeitpersonal.co/lyrics?artist=$SAFE_ARTIST&title=$SAFE_TITLE") + +printf "\"$TITLE\" by \"$ARTIST\" $ALBUM\n$LYRICS\n" + +fi diff --git a/q11k.sh b/q11k.sh new file mode 100755 index 0000000..94651fa --- /dev/null +++ b/q11k.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# An attempt to make the entire digimend configuration very simple and modular by allowing +# configurations for each program. +# Tablet info +tablet="HID 256c:006e Pad pad" +pen="HID 256c:006e Pen stylus" + + +# Set size stuff according to screen. +tabletX=55880 +tabletY=34925 +screenX=1920 +screenY=1080 +newtabletY=$(( $screenY * $tabletX / $screenX )) + +#xsetwacom --set "$pen" Area 0 0 $tabletX $newtabletY +xsetwacom --set "$pen" MapToOutput "eDP1" + +# Universal commands +# This stuff applies to both inkscape and GIMP seemingly. +u_zoomin="shift =" +u_zoomout="-" +u_zoomtool="z" +u_save="+ctrl s" +u_undo="+ctrl z" +u_redo="+ctrl y" +u_newlayer="+ctrl shift n" + +# Commands for GIMP +# GIMP is useful for photo editing and retouching, as well as other steps in the process. +g_brushinc="+bracketright" +g_brushdec="+bracketleft" +g_heal="h" +g_clone="c" +g_freesel="f" +g_warp="w" +g_pen="p" + +# Commands for Inkscape +# Inkscape can be used for notes as well as making visual lighting arrangements. +i_free="p" +i_brush="c" +i_rectangle="r" +i_text="t" +i_esc="esc" + +xsetwacom --set "$tablet" Button 1 "key $u_save" +xsetwacom --set "$tablet" Button 2 "key $u_undo" +xsetwacom --set "$tablet" Button 12 "key $g_heal" +xsetwacom --set "$tablet" Button 11 "key $g_clone" + +xsetwacom --set "$tablet" Button 8 "key $u_zoomin" +xsetwacom --set "$tablet" Button 3 "key $u_zoomout" + +xsetwacom --set "$tablet" Button 10 "key $g_freesel" +xsetwacom --set "$tablet" Button 9 "key $g_pen" + +xsetwacom --set "$pen" Button 2 "key $g_brushinc" +xsetwacom --set "$pen" Button 3 "key $g_brushdec" diff --git a/rofi-pass.sh b/rofi-pass.sh new file mode 100755 index 0000000..0813623 --- /dev/null +++ b/rofi-pass.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +greenclip print | head -n1 | xclip -selection clipboard -i +pkill --signal=SIGTSTP greenclip +pass clip +sleep $(($PASSWORD_STORE_CLIP_TIME + 5)) +notify-send "Clipboard re-enabled" +pkill --signal=SIGCONT greenclip diff --git a/rofi-radio.sh b/rofi-radio.sh new file mode 100755 index 0000000..3192b26 --- /dev/null +++ b/rofi-radio.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# MIT license. +# Author : Joshua Smith + +# Usage: Place in /usr/local/bin/ +# Call from rofi when you want to do anything inside of rofi-radio. + +OPTS="Playing\nNext\nPause\nStations\nRate\nSongs\nQuit" +RATEOPTS="Love\nHate\nTired\nNewStation" +HISTOPTS="History\nUpcoming\nExplain" +MENU="rofi -dmenu -i" +PBS="/tmp/pianobar_stations" +CTL="${XDG_CONFIG_HOME:-$HOME/.config}/pianobar/ctl" +ICO="/tmp/coverart.jpg" + +notify () { + if [[ -n $ICO ]]; then + notify-send -i $ICO "pianobar | $1" "$2" + else + notify-send -i /usr/share/icons/Luv/devices/16/multimedia-player.svg "pianobar | $1" "$2" + fi +} + +ratemenu () { + RATECASE=$(echo -e $RATEOPTS | $MENU) + [[ -z $RATECASE ]] && main + case "$RATECASE" in + Love) + echo "+" > $CTL + ;; + Hate) + echo "-" > $CTL + ;; + Tired) + echo "t" > $CTL + ;; + NewStation) + echo "v" > $CTL + ;; + esac +} + +main () { + MAINCASE=$(echo -e $OPTS | $MENU) + case "$MAINCASE" in + Playing) + ;; + Next) + echo "n" > $CTL + ;; + Pause) + echo "p" > $CTL + notify "Paused" "You have paused the station." + ;; + Stations) + STATION=$(cat $PBS | $MENU | sed -e 's/[^0-9].*//g') + # Check if station is even entered. If not, return to main menu. + if [[ -n $STATION ]]; then + if [[ -n $(cat $PBS | grep '^$STATION') ]]; then + echo "s$STATION" > $CTL + else + notify "Error" "$STATION is an invalid station number." + fi + else + main + fi + ;; + Rate) + ratemenu + ;; + Songs) + HISTCASE=$(echo -e $HISTOPS | $MENU) + [[ -z $HISTCASE ]] && main + case "$HISTCASE" in + History) + ;; + Upcoming) + ;; + Explain) + ;; + esac + ;; + Quit) + echo "q" > $CTL + rm $PBS $ICO + ;; + esac +} + +main diff --git a/run_flashbench.sh b/run_flashbench.sh new file mode 100755 index 0000000..17cee7c --- /dev/null +++ b/run_flashbench.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Please read http://wiki.laptop.org/go/SDCard_Testing before using. + +DEVFPATH=$1 +DEV=`basename ${DEVFPATH}` + +ERASESIZE=`cat /sys/block/${DEV}/device/preferred_erase_size 2>/dev/null` + +if mount | rg "^${DEVFPATH}.* / " ; then + echo Refusing to run on root filesystem + exit 1 +fi +echo Making sure the device has no mounted partitions +umount ${DEVFPATH}p* + +for F in name oemid manfid hwrev fwrev; do + echo $F `cat /sys/block/${DEV}/device/${F}` +done +echo Running flashbench +flashbench --open-au --open-au-nr=5 --random --blocksize=4096 \ + --erasesize=${ERASESIZE:-4194304} ${DEVFPATH} + diff --git a/scheme.sh b/scheme.sh new file mode 100755 index 0000000..5512544 --- /dev/null +++ b/scheme.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# A color picker using the "pastel" program in order to generate colors. + +# If no input provided (./scheme.sh red), use pastel to pick color. +if [ -z ${1+x} ]; then color=$(pastel pick); else color=$1; fi + +# Theme for select. +PS3="> " + +# Function to improve cleanliness of code, mostly for the all function. +color_loop () { + for x in $@ + do + out=$(pastel rotate $x $color | pastel format hex) + hex=$(pastel format hex $out) + name=$(pastel format name $out) + pastel paint "$hex" "Color: $name ($hex)" + done +} + +# Color scheme and harmony layouts. Easy to adjust and add to, in the case new color theory is developed. +complementary="0 180" +split="0 150 210" +analogous="-30 -15 0 15 30" +triadic="0 120 240" +tetra_rectangle="0 60 180 240" +tetra_square="0 90 180 270" + +# Color scheme selection. +echo "What color scheme do you want?" +select scheme in Complementary SplitComplementary Analogous Triadic Tetradic_Rectangle Tetradic_Square All +do + case $scheme in + "Complementary") + echo "Mode: $scheme" + color_loop $complementary + break + ;; + "SplitComplementary") + echo "Mode: $scheme" + color_loop $split + break + ;; + "Analogous") + echo "Mode: $scheme" + color_loop $analogous + break + ;; + "Triadic") + echo "Mode: $scheme" + color_loop $triadic + break + ;; + "Tetradic_Rectangle") + echo "Mode: $scheme" + color_loop $tetra_rectangle + break + ;; + "Tetradic_Square") + echo "Mode: $scheme" + color_loop $tetra_square + break + ;; + # This is bad. Whatever, homie. + "All") + echo "Mode: Complementary" + color_loop $complementary + echo "Mode: SplitComplementary" + color_loop $split + echo "Mode: Analogous" + color_loop $analogous + echo "Mode: Triadic" + color_loop $triadic + echo "Mode: Tetradic_Rectangle" + color_loop $tetra_rectangle + echo "Mode: Tetradic_Square" + color_loop $tetra_square + break + ;; + esac +done + diff --git a/teaprint.sh b/teaprint.sh new file mode 100755 index 0000000..c01442b --- /dev/null +++ b/teaprint.sh @@ -0,0 +1,65 @@ +#!/usr/bin/bash + +# Input text format is.. +# Year|Factory|Tea name|Category + +ALIGN="LEFT" +FONT="LEFT" +TEXTYP="NORMAL" +WIDTH=1 +HEIGHT=1 +DENSITY=1 + +PRINTLEN=42 +LNBREAK="" + +LNBREAK=$(awk -v count=$PRINTLEN 'BEGIN { OFS="~"; $(count+1)="";print}') + +setnorms () { + python-escpos set --align "left" --font "left" --text_type "NORMAL" \ + --height 1 --width 1 --density 1 +} + +fort () { + python-escpos set --align "center" --font "left" --text_type "B" \ + --height 1 --width 1 --density 3 + python-escpos text --txt $LNBREAK + python-escpos text --txt "$1" + python-escpos text --txt $LNBREAK +} + +DATA="" + +for file in "$@" +do + DATA=$(cat $file) + for ln in $DATA + do + COUNTER=0 + TEAARRAY=() + + for item in $(echo $ln | tr '\|' '\n') + do + TEAARRAY[$COUNTER]="$(echo $item | tr '_' ' ')" + COUNTER=$((COUNTER+1)) + done + + FORTUNE=$(fortune -sn $PRINTLEN) + + echo "From: ${TEAARRAY[0]}, Maker: ${TEAARRAY[1]}" + echo "Tea: ${TEAARRAY[2]}, Type: ${TEAARRAY[3]}" + echo -e "\t$FORTUNE\n" + + python-escpos set --align "left" --font "center" --text_type "NORMAL" \ + --height 1 --width 2 --density 3 + python-escpos text --txt "From: ${TEAARRAY[0]}" + python-escpos text --txt "Maker: ${TEAARRAY[1]}" + python-escpos text --txt "Tea: ${TEAARRAY[2]}" + python-escpos text --txt "Type: ${TEAARRAY[3]}" + fort "$FORTUNE" + python-escpos cut + + done +done + +setnorms