whiteout config update
parent
f21541e07c
commit
ff45f031bf
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
if test "$argv[1]" = "-w"
|
||||
set time $argv[2]
|
||||
test -z "$time" && set time 1
|
||||
while true
|
||||
echo (cpu-temp)
|
||||
sleep $time
|
||||
end
|
||||
else
|
||||
sensors -j | jq '."k10temp-pci-00c3".Tdie.temp1_input'
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set watermark watermark.tex
|
||||
set preface preface.pdf
|
||||
|
||||
function gen_watermark
|
||||
set -l id (random)
|
||||
cat "$watermark" | string replace -a "{{person}}" "$argv[1]" > "$id.tex"
|
||||
pdflatex "$id.tex" > /dev/null
|
||||
pdflatex "$id.tex" > /dev/null #run twice for transparency
|
||||
# remove log and aux file
|
||||
rm $id.aux $id.log $id.tex
|
||||
echo "$id.pdf"
|
||||
end
|
||||
|
||||
function assemble
|
||||
set -l id (random)
|
||||
set watermark_file (gen_watermark $argv)
|
||||
echo pdftk "$argv[2]" stamp "$watermark_file" output "$id.pdf"
|
||||
pdftk "$argv[2]" stamp "$watermark_file" output "$id.pdf"
|
||||
pdftk "$preface" "$id.pdf" output "$id"-marked.pdf
|
||||
# clean up files
|
||||
rm "$watermark_file"
|
||||
rm "$id.pdf"
|
||||
echo "$id"-marked.pdf
|
||||
end
|
||||
|
||||
assemble $argv
|
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set countrycode 'de'
|
||||
set lang 'en-US'
|
||||
set limit 1
|
||||
set q "$argv[1]"
|
||||
set raw 'false'
|
||||
|
||||
set jqstr '.lat, .lon, .display_name'
|
||||
|
||||
# if run in a terminal, one line per output
|
||||
if test -t 1
|
||||
set jqstr '"\(.lat) \(.lon) \(.display_name)"'
|
||||
set limit 5
|
||||
end
|
||||
|
||||
set i 1
|
||||
while test $i -le (count $argv)
|
||||
switch $argv[$i]
|
||||
case '-n'
|
||||
set i (math $i + 1)
|
||||
set limit $argv[$i]
|
||||
case '-c'
|
||||
set i (math $i + 1)
|
||||
set countrycode $argv[$i]
|
||||
case '-r'
|
||||
set raw 'true'
|
||||
case '*'
|
||||
set q $p $argv[$i]
|
||||
end
|
||||
set i (math $i + 1)
|
||||
end
|
||||
|
||||
set result (curl -s "https://nominatim.openstreetmap.org/search?q=$q&format=json&limit=$limit&countrycodes=$countrycode&accept-language=$lang")
|
||||
|
||||
if test "$raw" = 'true'
|
||||
echo $result | python -m json.tool
|
||||
else
|
||||
echo $result | jq -r ".[] | $jqstr"
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# syntax: moov files... regex target
|
||||
|
||||
set regex $argv[-2]
|
||||
set target $argv[-1]
|
||||
set files $argv[1..-3]
|
||||
|
||||
for file in $files
|
||||
set matches (string match -ar "$regex" "$file")
|
||||
set target_path "$target"
|
||||
|
||||
set counter 0
|
||||
for match in $matches
|
||||
set target_path (string replace -a '$'"$counter" "$match" "$target_path")
|
||||
set counter (math $counter + 1)
|
||||
end
|
||||
|
||||
mv "$file" "$target_path"
|
||||
end
|
||||
|
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set lat $argv[1]
|
||||
set lon $argv[2]
|
||||
set token '9755405ea54edcefb75bcc61cc9c3c60'
|
||||
|
||||
#if test ! -z $argv[3]
|
||||
# set_color green
|
||||
# echo "Weather at $argv[3]"
|
||||
# set_color normal
|
||||
#end
|
||||
|
||||
#curl -s "https://api.openweathermap.org/data/2.5/forecast?lat=$lat&lon=$lon&appid=$token" | jq -r '.list[] | "\(.dt_txt[0:16]) \(.weather[0].description) at \(.main.temp - 273.15|round)°C"'
|
||||
curl -s "https://api.openweathermap.org/data/2.5/forecast?lat=$lat&lon=$lon&appid=$token" | jq -r '.list[] | .main.temp - 273.15|round'
|
@ -0,0 +1,4 @@
|
||||
# Defined in /run/user/1000/fish.iwIwIq/la.fish @ line 2
|
||||
function la --description 'List contents of directory, including hidden files in directory using long format'
|
||||
ls -lahF $argv
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
# Defined in - @ line 1
|
||||
function ll --description 'alias ll=ls -AlFh'
|
||||
ls -AlFh $argv;
|
||||
# Defined in /tmp/fish.Ryo4Qd/ll.fish @ line 2
|
||||
function ll --description 'alias ll ls -l'
|
||||
ls -lhF $argv;
|
||||
end
|
||||
|
@ -1,4 +1,39 @@
|
||||
# Defined in /tmp/fish.dwCY0N/mount-vc.fish @ line 2
|
||||
# Defined in /tmp/fish.vUSaaU/mount-vc.fish @ line 2
|
||||
function mount-vc --argument device key_name target -d Mount a veracrypt container with a keyfile stored in /home/anton/.keys
|
||||
nix-shell -p veracrypt --run "sudo veracrypt -k /home/anton/.keys/$argv[2] -p \"\" $argv[1] $argv[3]"
|
||||
if test -z "$argv[1]" -o \( "$argv[1]" = "--help" \) -o \( "$argv[1]" = "-h" \)
|
||||
echo -e "mount-vc: Mount or dismount veracrypt volumes\n\
|
||||
\n\
|
||||
Usage:\n\
|
||||
mount a volume using a keyfile:\n\
|
||||
\n\
|
||||
mount-vc <device> <key file name> <target>\n\
|
||||
\n\
|
||||
mount a volume using a password: (will be prompted for)\n\
|
||||
\n\
|
||||
mount-vc <device> <target>\n\
|
||||
\n\
|
||||
dismount a volume:\n\
|
||||
\n\
|
||||
mount-vc -d <target>\n"
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if test "$argv[1]" = "-d"
|
||||
sudo veracrypt -d "argv[2]"
|
||||
return
|
||||
end
|
||||
|
||||
set dev "$argv[1]"
|
||||
set target "$argv[3]"
|
||||
set opts "-t" "--non-interactive"
|
||||
|
||||
if test (count $argv) = 2
|
||||
read -s -P "Volume password: " pass
|
||||
set target "$argv[2]"
|
||||
set -a opts "--password=$pass"
|
||||
else
|
||||
set -a opts "-k" "/home/anton/.keys/$argv[2]" "-p" ""
|
||||
end
|
||||
sudo veracrypt $opts "$dev" "$target"
|
||||
end
|
||||
|
@ -0,0 +1,22 @@
|
||||
# Defined in /home/anton/.config/fish/functions/mwatch.fish @ line 2
|
||||
function mwatch
|
||||
argparse --name=mwatch -s 'n=' -- $argv
|
||||
or return 1
|
||||
|
||||
set n "$_flag_n"
|
||||
test -z "$n" -o "$n" -le 0; and set n 2
|
||||
|
||||
while true
|
||||
set output (eval $argv)
|
||||
|
||||
clear
|
||||
|
||||
echo (date)" - refreshing every $n seconds"
|
||||
|
||||
for line in $output
|
||||
echo $line
|
||||
end
|
||||
|
||||
sleep "$n"
|
||||
end
|
||||
end
|
@ -1,3 +1,3 @@
|
||||
function telegram
|
||||
nix-shell -p tdesktop --run "telegram-desktop >/dev/null 2>&1 & disown"
|
||||
telegram-desktop >/dev/null 2>&1 & disown
|
||||
end
|
||||
|
@ -0,0 +1,53 @@
|
||||
# Defined in /tmp/fish.iOyNXX/todo.fish @ line 2
|
||||
function todo
|
||||
argparse --name=todo 'n/next' 't/today' 's/show' 'r/rotate' 'd/done=' -- $argv
|
||||
or return 1
|
||||
|
||||
test -n "$_flag_n"; and set -l day 'next'
|
||||
test -n "$_flag_t"; and set -l day 'today'
|
||||
|
||||
test -z "$day" -a -n "$_flag_s"; and set -l day 'today'
|
||||
test -z "$day" -a -n "$_flag_d"; and set -l day 'today'
|
||||
test -z "$day"; and set -l day 'next'
|
||||
|
||||
set day_print "$day"
|
||||
test "$day" = "next"; and set day_print "tomorrow" # rename next to tomorrow when printing
|
||||
|
||||
set file ~/todo/"$day".md
|
||||
|
||||
|
||||
if test -n "$_flag_s"
|
||||
test ! -e "$file"; and echo "Nothing todo $day_print"; and return 0
|
||||
|
||||
echo -e "# TODO $day_print\n" | bat --color always -l markdown -p - "$file"
|
||||
else if test -n "$_flag_r"
|
||||
# if no todos are due for tomorrow, return
|
||||
test ! -e ~/todo/next.md;and echo "Nothing todo tomorrow"; and return 0
|
||||
|
||||
cat ~/todo/next.md >> ~/todo/today.md
|
||||
rm ~/todo/next.md
|
||||
else if test -n "$_flag_d"
|
||||
# the number to remove is first arg
|
||||
set num "$_flag_d"
|
||||
set num (math "1 + ($num - 1) * 2")
|
||||
|
||||
set todos (cat "$file")
|
||||
|
||||
set elem $todos[$num]
|
||||
|
||||
# remove fields in array
|
||||
set -e todos[$num]
|
||||
set -e todos[$num]
|
||||
|
||||
# join elements by newlines. This creates a leading newline
|
||||
# which is then ignored by using tail with the count of elements
|
||||
# in the todos array
|
||||
echo -e \n$todos | tail -(count $todos) > "$file"
|
||||
|
||||
echo "\"$elem\" is no longer on the list for $day_print"
|
||||
|
||||
else
|
||||
echo -e "* $argv\n" >> $file
|
||||
echo "Added todo for $day_print: \"$argv\""
|
||||
end
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
# Defined in - @ line 1
|
||||
function todos --description 'alias todos=todo -s'
|
||||
todo -s $argv;
|
||||
end
|
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set whitelist inbox pics docs music movies
|
||||
|
||||
set blacklist Desktop Downloads/Telegram\ Desktop Downloads Documents
|
||||
|
||||
set inbox inbox
|
||||
|
||||
|
||||
# make sure whitelisted items exist
|
||||
|
||||
set_color green
|
||||
|
||||
for folder in $whitelist
|
||||
test ! -d ~/"$folder"
|
||||
and mkdir -p ~/"$folder"
|
||||
and echo " * created ~/$folder"
|
||||
or echo " * skipping ~/$folder"
|
||||
# echo "==="
|
||||
end
|
||||
|
||||
|
||||
# move blacklisted items into inbox, delete folders
|
||||
|
||||
set_color red
|
||||
|
||||
for folder in $blacklist
|
||||
test -d ~/"$folder"
|
||||
and cp -r ~/"$folder"/. ~/"$inbox"
|
||||
and rm -r ~/"$folder"
|
||||
and echo " * removed ~/$folder"
|
||||
or echo " * skipping ~/$folder"
|
||||
#echo "==="
|
||||
end
|
||||
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue