initial commit
commit
0ac22ca91e
@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
# listen to battery state and warn on low battery
|
||||||
|
|
||||||
|
# read low battery state level from environment and fallback to a value of 8
|
||||||
|
set LOW 8
|
||||||
|
test -n "$BAT_CRITICAL_LEVEL" -a "$BAT_CRITICAL_LEVEL" -gt 0; and set LOW "$BAT_CRITICAL_LEVEL"
|
||||||
|
|
||||||
|
# read config from environment
|
||||||
|
set ALARM_TEMP 1000
|
||||||
|
test -z "$BAT_ALARM_TEMP" -a "$BAT_ALARM_TEMP" -gt 1000; and set ALARM_TEMP "$BAT_ALARM_TEMP"
|
||||||
|
|
||||||
|
# if we are currently below or above our LOW threshold
|
||||||
|
set isLow "false"
|
||||||
|
|
||||||
|
# print config
|
||||||
|
echo "Set up with LOW=$LOW and ALARM_TEMP=$ALARM_TEMP"
|
||||||
|
#echo "redshift="(which redshift)
|
||||||
|
|
||||||
|
function check_btry
|
||||||
|
set state (upower -i /org/freedesktop/UPower/devices/battery_BAT0 | rg "(percent|state)" | awk -F " " '{print $2}')
|
||||||
|
|
||||||
|
set charge (echo "$state[2]" | string replace "%" "")
|
||||||
|
set state "$state[1]"
|
||||||
|
|
||||||
|
set c_low (test "$charge" -lt "$LOW"; and echo true; or echo false)
|
||||||
|
|
||||||
|
if test $c_low = true; and test $state = discharging; and test $isLow != true
|
||||||
|
echo "transitioning to low battery state"
|
||||||
|
low_btry_action
|
||||||
|
set isLow true
|
||||||
|
else if test ! $state = discharging; and test $isLow != false
|
||||||
|
echo "transtioning to high bat state (charger)"
|
||||||
|
set isLow false
|
||||||
|
high_btry_action
|
||||||
|
else if test $c_low = false; and test $isLow != false
|
||||||
|
echo "transitioning to high bat state (magic)"
|
||||||
|
set isLow false
|
||||||
|
high_btry_action
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function low_btry_action
|
||||||
|
# kill redshift job and set fixed alarm temp
|
||||||
|
if jobs -q
|
||||||
|
echo killing redshift with pid (jobs -p)
|
||||||
|
kill (jobs -p)
|
||||||
|
end
|
||||||
|
redshift -P -O "$ALARM_TEMP"
|
||||||
|
end
|
||||||
|
|
||||||
|
function high_btry_action
|
||||||
|
# start redshift again
|
||||||
|
|
||||||
|
redshift -P -l 50.11552:8.68417 -t 5500:2500 &
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if test "$argv[1]" = once
|
||||||
|
check_btry
|
||||||
|
|
||||||
|
set state (upower -i /org/freedesktop/UPower/devices/battery_BAT0 | rg "(percent|state)" | awk -F " " '{print $2}')
|
||||||
|
|
||||||
|
set charge (echo "$state[2]" | string replace "%" "")
|
||||||
|
set state "$state[1]"
|
||||||
|
|
||||||
|
echo "$charge : $state"
|
||||||
|
else
|
||||||
|
#set percent (upower -i /org/freedesktop/UPower/devices/battery_BAT0 | rg "(percent)" | awk -F " " '{print $2}' | string replace "%" "")
|
||||||
|
|
||||||
|
# set initial isLow variable to the opposite of what it's supposed to be to trigger a
|
||||||
|
#test "$percent" -lt "$LOW"; and set isLow "false"
|
||||||
|
set isLow unknown
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
while true
|
||||||
|
check_btry
|
||||||
|
sleep (test $isLow = true; and echo 1; or echo 60)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
# config:
|
||||||
|
# put your device here
|
||||||
|
device="/sys/class/backlight/amdgpu_bl0/"
|
||||||
|
|
||||||
|
def smart_int(num):
|
||||||
|
if (num[0] == '+'): return int(num[1:])
|
||||||
|
return int(num)
|
||||||
|
|
||||||
|
def do_action(action):
|
||||||
|
if (action == 'show'):
|
||||||
|
curr = get_current()
|
||||||
|
_max = get_max()
|
||||||
|
print('screen brightness is at %s (%d/%d)' % (str(int(curr / _max * 100)), curr, _max));
|
||||||
|
return
|
||||||
|
if (action[-1:] == '%'):
|
||||||
|
if (action[0] == "+" or action[0] == '-'):
|
||||||
|
curr = get_current()
|
||||||
|
max = get_max()
|
||||||
|
curr_pc = curr / max * 100
|
||||||
|
put_brightness(int(max * ((curr_pc + smart_int(action[:-1])) / 100)))
|
||||||
|
else:
|
||||||
|
put_brightness(int(get_max() * (int(action[:-1]) / 100)))
|
||||||
|
|
||||||
|
elif (action[0] == '+' or action[0] == "-"):
|
||||||
|
put_brightness(get_current() + smart_int(action))
|
||||||
|
elif (action.isdigit()):
|
||||||
|
put_brightness(int(action))
|
||||||
|
|
||||||
|
def get_current():
|
||||||
|
with open(device + 'brightness', 'r') as f:
|
||||||
|
return int(f.read().replace('\n', ''))
|
||||||
|
|
||||||
|
def put_brightness(ammount):
|
||||||
|
ammount = num_in_range(ammount)
|
||||||
|
print("screen brightnes is " + str(ammount));
|
||||||
|
with open(device + 'brightness', 'r+') as f:
|
||||||
|
f.write(str(ammount))
|
||||||
|
|
||||||
|
def get_max():
|
||||||
|
with open(device + 'max_brightness', 'r') as f:
|
||||||
|
return int(f.read().replace('\n', ''))
|
||||||
|
|
||||||
|
def num_in_range(num):
|
||||||
|
max = get_max()
|
||||||
|
if (num > max): num = max
|
||||||
|
if (num < 0): num = 0
|
||||||
|
return num
|
||||||
|
|
||||||
|
|
||||||
|
for action in sys.argv[1::]: do_action(action)
|
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
remote="git.pi"
|
||||||
|
|
||||||
|
|
||||||
|
cmd=${1:-""}
|
||||||
|
|
||||||
|
if [ "$cmd" == "init" ]; then
|
||||||
|
name="$2"
|
||||||
|
|
||||||
|
if [ ! -d "$name" ]; then
|
||||||
|
mkdir $name
|
||||||
|
fi;
|
||||||
|
|
||||||
|
cd $name
|
||||||
|
ssh git@git.pi "./create-repo.sh $name"
|
||||||
|
|
||||||
|
if [ ! -d ".git" ]; then
|
||||||
|
git init
|
||||||
|
fi;
|
||||||
|
git remote add local "git@$remote:$name.git"
|
||||||
|
elif [ "$cmd" == "clone" ]; then
|
||||||
|
name="$2"
|
||||||
|
git clone "git@$remote:$name.git" $name
|
||||||
|
else
|
||||||
|
echo "usage: gitlocal (init|clone) repository
|
||||||
|
|
||||||
|
remote: $remote
|
||||||
|
|
||||||
|
init: initialize repository on the remote server, then create a local folder linked to the remote
|
||||||
|
clone: clone a git repository from the remote";
|
||||||
|
fi;
|
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
# get file name from path
|
||||||
|
function fname
|
||||||
|
string replace -r "^"(dirname "$argv[1]")/ "" "$argv[1]"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# convert a note name or otherwise stuff to a notes path
|
||||||
|
function n_path
|
||||||
|
if string match -qr "^"(realpath ~/notes) "$argv[1]"
|
||||||
|
echo $argv[1]
|
||||||
|
end
|
||||||
|
echo (realpath ~/notes)/(string replace -ar "\s" "_" "$argv[1]")
|
||||||
|
end
|
||||||
|
|
||||||
|
# ensure .md ending
|
||||||
|
function ensure_md
|
||||||
|
if test (count $argv) -eq 0 -a -t 0
|
||||||
|
read inp
|
||||||
|
else
|
||||||
|
set inp "$argv[1]"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if string match -qr "\.md\$" "$inp"
|
||||||
|
echo "$inp"
|
||||||
|
else
|
||||||
|
echo "$inp.md"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# edit a note, arg1 = note name
|
||||||
|
function note_edit
|
||||||
|
eval $EDITOR (n_path "$argv[1]" | ensure_md)
|
||||||
|
end
|
||||||
|
|
||||||
|
# create a new note
|
||||||
|
# agr1 = note name (path)
|
||||||
|
# arg2 = (opt) note content
|
||||||
|
function note_new
|
||||||
|
set path (n_path "$argv[1]" | ensure_md)
|
||||||
|
|
||||||
|
if test -f "$path"
|
||||||
|
echo "note at $path already exists"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# create path for note
|
||||||
|
mkdir -p (dirname "$path")
|
||||||
|
|
||||||
|
echo -e "# "(fname "$argv[1]")"\n\n$argv[2]" > $path
|
||||||
|
|
||||||
|
note_edit "$path"
|
||||||
|
end
|
||||||
|
|
||||||
|
# show a note
|
||||||
|
# arg1 = path to note (or folder)
|
||||||
|
# arg2 = delimiter (default=", "
|
||||||
|
function note_search
|
||||||
|
set root (realpath ~/notes)/
|
||||||
|
set results
|
||||||
|
|
||||||
|
set delim ", "
|
||||||
|
test -n "$argv[2]"; and set delim "$argv[2]"
|
||||||
|
|
||||||
|
for f in (rg -l "$argv[1]" ~/notes)
|
||||||
|
set f (string replace "$root" "" "$f")
|
||||||
|
set results "$f" $results
|
||||||
|
end
|
||||||
|
|
||||||
|
echo -e (string join "$delim" $results)
|
||||||
|
end
|
||||||
|
|
||||||
|
# print the contents of a note
|
||||||
|
# arg1 = desired note path
|
||||||
|
function note_print
|
||||||
|
set path (n_path "$argv[1]" | ensure_md)
|
||||||
|
if test ! -f (n_path "$path")
|
||||||
|
echo "note at $path is not a file!"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
cat "$path"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# main
|
||||||
|
if test "$argv[1]" = "create"
|
||||||
|
note_new $argv[2..-1]
|
||||||
|
else if test "$argv[1]" = "edit"
|
||||||
|
note_edit $argv[2..-1]
|
||||||
|
else if test "$argv[1]" = "find" -o "$argv[1]" = "search"
|
||||||
|
note_search $argv[2..-1]
|
||||||
|
else if test "$argv[1]" = "git"
|
||||||
|
eval git -C ~/notes/ $argv[2..-1]
|
||||||
|
else if test "$argv[1]" = "print" -o "$argv[1]" = "show"
|
||||||
|
note_print $argv[2..-1]
|
||||||
|
else if test "$argv[1]" = "list" -o "$argv[1]" = "tree"
|
||||||
|
tree ~/notes/
|
||||||
|
else
|
||||||
|
echo "Unknown argument: $argv[1]"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# grab parameters, trim whitespaces
|
||||||
|
length="${*// }";
|
||||||
|
|
||||||
|
# look for easy mode "-e"
|
||||||
|
if [[ "$length" =~ ^-e$ ]]; then
|
||||||
|
passw=$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 32);
|
||||||
|
echo $passw | tr -d '\n' | xclip -selection c;
|
||||||
|
echo $passw
|
||||||
|
exit 0
|
||||||
|
elif [[ "$length" =~ ^-e=([0-9]+)$ ]]; then
|
||||||
|
# get length from regex
|
||||||
|
len=${BASH_REMATCH[1]};
|
||||||
|
passw=$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c "$len");
|
||||||
|
echo $passw | tr -d '\n' | xclip -selection c;
|
||||||
|
echo $passw
|
||||||
|
exit 0
|
||||||
|
# look for -b=bytes
|
||||||
|
elif [[ "$length" =~ ^-b=([0-9]+)$ ]]; then
|
||||||
|
# set bytes
|
||||||
|
bytes=${BASH_REMATCH[1]};
|
||||||
|
# set length
|
||||||
|
let length=4*bytes/3+1;
|
||||||
|
# instead of ceiling the function, we just floor it and add 1, because the output length was specified in bytes
|
||||||
|
else
|
||||||
|
if [[ -z "$length" ]]; then
|
||||||
|
# if no parameters were given, the default is used
|
||||||
|
length=32
|
||||||
|
bytes=24
|
||||||
|
else
|
||||||
|
if ! [[ "$length" =~ ^[0-9]+$ ]]; then
|
||||||
|
echo -e "\e[91mError: '$length' is not a number!\e[0m";
|
||||||
|
exit 100;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# calculate the bytes from the length
|
||||||
|
let bytes=30*length/4;
|
||||||
|
# ceil the result using python
|
||||||
|
|
||||||
|
bytes=$(python -c "from math import ceil; print ceil($bytes/10.0)" | tr -d '.0');
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# generate the password
|
||||||
|
password=$(dd if=/dev/urandom bs=1 count="$bytes" 2>/dev/null | base64);
|
||||||
|
|
||||||
|
# idk why but they keep adding a newline after every 76th character, compensate for that!
|
||||||
|
let length=length+length/77;
|
||||||
|
|
||||||
|
# cut it and echo it
|
||||||
|
echo "${password:0:$length}" | tr -d '\n';
|
||||||
|
|
||||||
|
# we removed the newlines from the middle of the password adn from the end, add the one at the end back
|
||||||
|
echo "";
|
||||||
|
|
||||||
|
# copy the password to clipboard
|
||||||
|
echo "${password:0:$length}" | tr -d '\n' | xclip -selection c;
|
||||||
|
|
||||||
|
exit 0;
|
@ -0,0 +1,81 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# This script is a simple wrapper which prefixes each i3status line with custom
|
||||||
|
# information. It is a python reimplementation of:
|
||||||
|
# http://code.stapelberg.de/git/i3status/tree/contrib/wrapper.pl
|
||||||
|
#
|
||||||
|
# To use it, ensure your ~/.i3status.conf contains this line:
|
||||||
|
# output_format = "i3bar"
|
||||||
|
# in the 'general' section.
|
||||||
|
# Then, in your ~/.i3/config, use:
|
||||||
|
# status_command i3status | ~/i3status/contrib/wrapper.py
|
||||||
|
# In the 'bar' section.
|
||||||
|
#
|
||||||
|
# In its current version it will display the cpu frequency governor, but you
|
||||||
|
# are free to change it to display whatever you like, see the comment in the
|
||||||
|
# source code below.
|
||||||
|
#
|
||||||
|
# © 2012 Valentin Haenel <valentin.haenel@gmx.de>
|
||||||
|
#
|
||||||
|
# This program is free software. It comes without any warranty, to the extent
|
||||||
|
# permitted by applicable law. You can redistribute it and/or modify it under
|
||||||
|
# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
|
||||||
|
# 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
|
||||||
|
# details.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
from os import listdir
|
||||||
|
from os.path import isfile, join
|
||||||
|
|
||||||
|
def get_inbox_items():
|
||||||
|
path = "/home/anton/inbox"
|
||||||
|
files = listdir(path)
|
||||||
|
if not files:
|
||||||
|
return bar_entry('∅', 'inbox', '#00FF00')
|
||||||
|
files.sort()
|
||||||
|
return bar_entry("inbox: " + ", ".join(files), 'inbox', '#FF0000')
|
||||||
|
|
||||||
|
|
||||||
|
def bar_entry(content, name, color = '#000000'):
|
||||||
|
return {'full_text' : content, 'name' : name, 'color': color}
|
||||||
|
|
||||||
|
def print_line(message):
|
||||||
|
""" Non-buffered printing to stdout. """
|
||||||
|
sys.stdout.write(message + '\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def read_line():
|
||||||
|
""" Interrupted respecting reader for stdin. """
|
||||||
|
# try reading a line, removing any extra whitespace
|
||||||
|
try:
|
||||||
|
line = sys.stdin.readline().strip()
|
||||||
|
# i3status sends EOF, or an empty line
|
||||||
|
if not line:
|
||||||
|
sys.exit(3)
|
||||||
|
return line
|
||||||
|
# exit on ctrl-c
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# Skip the first line which contains the version header.
|
||||||
|
print_line(read_line())
|
||||||
|
|
||||||
|
# The second line contains the start of the infinite array.
|
||||||
|
print_line(read_line())
|
||||||
|
|
||||||
|
while True:
|
||||||
|
line, prefix = read_line(), ''
|
||||||
|
# ignore comma at start of lines
|
||||||
|
if line.startswith(','):
|
||||||
|
line, prefix = line[1:], ','
|
||||||
|
|
||||||
|
j = json.loads(line)
|
||||||
|
# insert information into the start of the json, but could be anywhere
|
||||||
|
# CHANGE THIS LINE TO INSERT SOMETHING ELSE
|
||||||
|
j.insert(0, get_inbox_items())
|
||||||
|
# and echo back new encoded json
|
||||||
|
print_line(prefix+json.dumps(j))
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
alias wificonnect='nmcli connection up'
|
||||||
|
alias nix-shell='nix-shell --command fish'
|
||||||
|
|
||||||
|
set PATH ~/.bin $PATH
|
||||||
|
|
||||||
|
if test "$TERMINAL" = 'termite'
|
||||||
|
set TERM xterm-color
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_exit --on-event fish_exit
|
||||||
|
if test (status -f) = 'Standard input';
|
||||||
|
set byebyes "bravo six, going dark" "bye bye" "ight, imma head out" "see ya!" "I'LL BE BACK" "my job here is done"
|
||||||
|
echo $byebyes[(random 1 (count $byebyes))]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function random_iasip
|
||||||
|
set folge (find "/home/anton/movies/IASIP S1-10/" -iname "*.mkv" | shuf -n 1)
|
||||||
|
env VLC_VERBOSE=0 vlc "$folge" 2> /dev/null
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
# This file contains fish universal variable definitions.
|
||||||
|
# VERSION: 3.0
|
||||||
|
SETUVAR __fish_init_2_39_8:\x1d
|
||||||
|
SETUVAR __fish_init_2_3_0:\x1d
|
||||||
|
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||||
|
SETUVAR fish_color_cancel:\x2dr
|
||||||
|
SETUVAR fish_color_command:\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_comment:red
|
||||||
|
SETUVAR fish_color_cwd:green
|
||||||
|
SETUVAR fish_color_cwd_root:red
|
||||||
|
SETUVAR fish_color_end:brmagenta
|
||||||
|
SETUVAR fish_color_error:brred
|
||||||
|
SETUVAR fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_host:normal
|
||||||
|
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||||
|
SETUVAR fish_color_normal:normal
|
||||||
|
SETUVAR fish_color_operator:bryellow
|
||||||
|
SETUVAR fish_color_param:cyan
|
||||||
|
SETUVAR fish_color_quote:yellow
|
||||||
|
SETUVAR fish_color_redirection:brblue
|
||||||
|
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SETUVAR fish_color_user:brgreen
|
||||||
|
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||||
|
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||||
|
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||||
|
SETUVAR fish_pager_color_completion:\x1d
|
||||||
|
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||||
|
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
|
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
@ -0,0 +1,31 @@
|
|||||||
|
# This file is automatically generated by the fish.
|
||||||
|
# Do NOT edit it directly, your changes will be overwritten.
|
||||||
|
SET __fish_init_2_39_8:\x1d
|
||||||
|
SET __fish_init_2_3_0:\x1d
|
||||||
|
SET fish_color_autosuggestion:555\x1ebrblack
|
||||||
|
SET fish_color_cancel:\x2dr
|
||||||
|
SET fish_color_command:\x2d\x2dbold
|
||||||
|
SET fish_color_comment:red
|
||||||
|
SET fish_color_cwd:green
|
||||||
|
SET fish_color_cwd_root:red
|
||||||
|
SET fish_color_end:brmagenta
|
||||||
|
SET fish_color_error:brred
|
||||||
|
SET fish_color_escape:bryellow\x1e\x2d\x2dbold
|
||||||
|
SET fish_color_history_current:\x2d\x2dbold
|
||||||
|
SET fish_color_host:normal
|
||||||
|
SET fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||||
|
SET fish_color_normal:normal
|
||||||
|
SET fish_color_operator:bryellow
|
||||||
|
SET fish_color_param:cyan
|
||||||
|
SET fish_color_quote:yellow
|
||||||
|
SET fish_color_redirection:brblue
|
||||||
|
SET fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SET fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SET fish_color_user:brgreen
|
||||||
|
SET fish_color_valid_path:\x2d\x2dunderline
|
||||||
|
SET fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||||
|
SET fish_key_bindings:fish_default_key_bindings
|
||||||
|
SET fish_pager_color_completion:\x1d
|
||||||
|
SET fish_pager_color_description:B3A06D\x1eyellow
|
||||||
|
SET fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
|
SET fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
@ -0,0 +1,9 @@
|
|||||||
|
function atril --description "the better atril"
|
||||||
|
echo -ne "opening "
|
||||||
|
set_color -i cyan
|
||||||
|
echo -ne "$argv"
|
||||||
|
set_color normal
|
||||||
|
echo " in atril..."
|
||||||
|
command atril $argv & disown
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
# Defined in /tmp/fish.ZxMSyI/bayern-login.fish @ line 2
|
||||||
|
function bayern-login
|
||||||
|
wificonnect @BayernWLAN
|
||||||
|
set root /home/anton/projects/bavaria-wifi
|
||||||
|
|
||||||
|
set_color -o green; echo -e "CONNECTED"; set_color normal
|
||||||
|
sleep 2
|
||||||
|
bw-check
|
||||||
|
#set fname all.min-(date +%Y-%m-%d-%H-%M-%S).js
|
||||||
|
#set js (curl https://hotspot.vodafone.de/bayern/dist/js/all.min.js)
|
||||||
|
#set sha (echo -n "$js" | sha1sum | string split " ")[1]
|
||||||
|
|
||||||
|
#if ! cat $root/shasums | grep $sha
|
||||||
|
# echo "$js" > $root/scripts/$fname
|
||||||
|
# echo "Found new script! sha: $sha. Saved in $root/scripts/$fname"
|
||||||
|
# echo "$sha" >> $root/shasums
|
||||||
|
#end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
# Defined in /tmp/fish.xZCDu4/bw-check.fish @ line 2
|
||||||
|
function bw-check
|
||||||
|
set root /home/anton/projects/bavaria-wifi
|
||||||
|
set fname all.min-(date +%Y-%m-%d-%H-%M-%S).js
|
||||||
|
set js (curl -s https://hotspot.vodafone.de/bayern/dist/js/all.min.js)
|
||||||
|
set sha (echo -n "$js" | sha1sum | string split " ")[1]
|
||||||
|
|
||||||
|
if ! cat $root/shasums | grep $sha
|
||||||
|
echo "$js" > $root/scripts/$fname
|
||||||
|
echo -e "Found new script! sha: $sha.\nSaved in $root/scripts/$fname"
|
||||||
|
echo "$sha" (date +%Y-%m-%d-%H-%M-%S) >> $root/shasums
|
||||||
|
else
|
||||||
|
echo "nothing new"
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
function code-py
|
||||||
|
nix-shell -p python37Packages.pylint --run "code $argv"
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
function dgc-env
|
||||||
|
set p3p python37Packages
|
||||||
|
nix-shell -p $p3p.requests $p3p.lxml $p3p.beautifulsoup4 $p3p.clint
|
||||||
|
end
|
@ -0,0 +1,19 @@
|
|||||||
|
function fish_greeting
|
||||||
|
if test "$TERM_PROGRAM" = vscode
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
set greetings "Hello there" (echo -ne "Aye aye, "; set_color -o; echo -ne "captain"; set_color normal) \
|
||||||
|
"Welcome back, Commander Shepard" "Waiting for orders!"
|
||||||
|
|
||||||
|
set greet $greetings[(random 1 (count $greetings))]
|
||||||
|
|
||||||
|
echo -ne "\n\t"$greet"\n\n"
|
||||||
|
|
||||||
|
if test (count (ls -A ~/inbox)) -ne 0;
|
||||||
|
set_color red
|
||||||
|
echo -e "\tInbox not empty!"
|
||||||
|
set_color normal
|
||||||
|
ls -1 --quoting-style=literal inbox/ | string join ", "
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,37 @@
|
|||||||
|
# Defined in /home/anton/.config/fish/functions/fish_prompt.fish @ line 1
|
||||||
|
function fish_prompt
|
||||||
|
set -l git_branch (git branch ^/dev/null | sed -n '/\* /s///p')
|
||||||
|
|
||||||
|
if test -n "$git_branch" -a (pwd) != /home/anton
|
||||||
|
set git_branch " [$git_branch]"
|
||||||
|
else
|
||||||
|
set git_branch ""
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -n "$IN_NIX_SHELL"
|
||||||
|
set_color cyan
|
||||||
|
echo -n "nix "
|
||||||
|
set_color normal
|
||||||
|
end
|
||||||
|
|
||||||
|
# set_color cyan
|
||||||
|
echo -n (whoami)
|
||||||
|
set_color normal
|
||||||
|
echo -n '@'
|
||||||
|
# set_color bryellow
|
||||||
|
echo -n (hostname)
|
||||||
|
|
||||||
|
if status is-interactive-job-control; and test (jobs | wc -l) -gt 0
|
||||||
|
set_color cyan
|
||||||
|
echo -n " #"(jobs | wc -l)
|
||||||
|
end
|
||||||
|
|
||||||
|
set_color yellow
|
||||||
|
echo -n "$git_branch"
|
||||||
|
|
||||||
|
set_color green
|
||||||
|
echo -n ' '(prompt_pwd)
|
||||||
|
|
||||||
|
set_color normal
|
||||||
|
echo ' > '
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
function inbox -d "manipulate your inbox"
|
||||||
|
if test -z "$argv"
|
||||||
|
ls -1 --quoting-style=literal ~/inbox/ | string join ", "
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if test "$argv" = "--clear"
|
||||||
|
rm -r ~/inbox/*
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if echo "$argv" | grep -q " -mv "
|
||||||
|
set move_flag true
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -f "$argv[1]" -o -d "$argv[1]"
|
||||||
|
cp -r "$argv[1]" ~/inbox/
|
||||||
|
else
|
||||||
|
echo -e (string join "\n" $argv[2..-1])"\n" > ~/inbox/$argv[1]
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
# Defined in - @ line 1
|
||||||
|
function ll --description 'alias ll=ls -AlFh'
|
||||||
|
ls -AlFh $argv;
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
# Defined in /tmp/fish.dwCY0N/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]"
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
function pythonEnv --description 'start a nix-shell with the given python packages' --argument pythonVersion
|
||||||
|
if set -q argv[2]
|
||||||
|
set argv $argv[2..-1]
|
||||||
|
end
|
||||||
|
|
||||||
|
for el in $argv
|
||||||
|
set ppkgs $ppkgs "python"$pythonVersion"Packages.$el"
|
||||||
|
end
|
||||||
|
|
||||||
|
nix-shell -p $ppkgs
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
function telegram
|
||||||
|
nix-shell -p tdesktop --run "telegram-desktop >/dev/null 2>&1 & disown"
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
# Defined in - @ line 1
|
||||||
|
function vi --description 'alias vi nvim'
|
||||||
|
nvim $argv;
|
||||||
|
end
|
@ -0,0 +1,53 @@
|
|||||||
|
# i3status configuration file.
|
||||||
|
# see "man i3status" for documentation.
|
||||||
|
# It is important that this file is edited as UTF-8.
|
||||||
|
# The following line should contain a sharp s:
|
||||||
|
# ß
|
||||||
|
# If the above line is not correctly displayed, fix your editor first!
|
||||||
|
|
||||||
|
general {
|
||||||
|
output_format = i3bar
|
||||||
|
colors = true
|
||||||
|
interval = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#order += "ipv6"
|
||||||
|
order += "wireless _first_"
|
||||||
|
order += "ethernet _first_"
|
||||||
|
order += "battery all"
|
||||||
|
order += "disk /"
|
||||||
|
order += "load"
|
||||||
|
order += "memory"
|
||||||
|
order += "tztime local"
|
||||||
|
|
||||||
|
wireless _first_ {
|
||||||
|
format_up = "W: (%quality at %essid) %ip"
|
||||||
|
format_down = "W: -"
|
||||||
|
}
|
||||||
|
|
||||||
|
ethernet _first_ {
|
||||||
|
format_up = "E: %ip (%speed)"
|
||||||
|
format_down = "E: -"
|
||||||
|
}
|
||||||
|
|
||||||
|
battery all {
|
||||||
|
format = "%status %percentage (%remaining at %consumption)"
|
||||||
|
}
|
||||||
|
|
||||||
|
disk "/" {
|
||||||
|
format = "%avail"
|
||||||
|
}
|
||||||
|
|
||||||
|
load {
|
||||||
|
format = "%1min"
|
||||||
|
}
|
||||||
|
|
||||||
|
memory {
|
||||||
|
format = "%used ~ %available"
|
||||||
|
threshold_degraded = "1G"
|
||||||
|
format_degraded = "MEMORY < %available"
|
||||||
|
}
|
||||||
|
|
||||||
|
tztime local {
|
||||||
|
format = "%Y-%m-%d %H:%M:%S"
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services = {
|
||||||
|
# power management
|
||||||
|
#tlp.enable = true;
|
||||||
|
|
||||||
|
upower.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
powerManagement.scsiLinkPolicy = "med_power_with_dipm";
|
||||||
|
|
||||||
|
# sound
|
||||||
|
sound.enable = true;
|
||||||
|
hardware.pulseaudio.enable = true;
|
||||||
|
|
||||||
|
# backlight
|
||||||
|
hardware.acpilight.enable = true;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
set DOTFILES_REPO (pwd)
|
||||||
|
|
||||||
|
## add thing to dotfiles repository (path or file)
|
||||||
|
function add_dotfiles
|
||||||
|
set system "$argv[1]"
|
||||||
|
set local "$argv[2]"
|
||||||
|
|
||||||
|
if grep -q -e "^$local" system_setup
|
||||||
|
echo "folder $local already in repo!"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -d "$system"
|
||||||
|
cp -r "$system" "$local"
|
||||||
|
rm -rf "$system"
|
||||||
|
else if test -f "$system"
|
||||||
|
cp "$system" "$local"
|
||||||
|
rm -f "$system"
|
||||||
|
else
|
||||||
|
echo "unknown file type at $argv[1]"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
ln -s "$DOTFILES_REPO"/"$argv[2]" "$argv[1]"
|
||||||
|
|
||||||
|
echo "$argv[2] $argv[1]" >> system_setup
|
||||||
|
end
|
||||||
|
|
||||||
|
## link dotfiles everywhere
|
||||||
|
function restore_system
|
||||||
|
for line in (cat system_setup)
|
||||||
|
if test -z $line
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
|
set line (string split -n " " "$line")
|
||||||
|
|
||||||
|
set local "$line[1]"
|
||||||
|
set system "$line[2]"
|
||||||
|
|
||||||
|
echo $local → $system
|
||||||
|
|
||||||
|
rm -rf "$system"
|
||||||
|
ln -s "$DOTFILES_REPO"/"$local" "$system"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if test "$argv[1]" = "add"
|
||||||
|
add_dotfiles $argv[2..-1]
|
||||||
|
else if test "$argv[1]" = "build"
|
||||||
|
restore_system $argv[2..-1]
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
bin /home/anton/.bin
|
||||||
|
i3 /home/anton/.config/i3
|
||||||
|
i3status /home/anton/.config/i3status
|
||||||
|
termite /home/anton/.config/termite
|
||||||
|
fish /home/anton/.config/fish
|
||||||
|
nixos /etc/nixos
|
@ -0,0 +1,10 @@
|
|||||||
|
[options]
|
||||||
|
audible_bell=1
|
||||||
|
allow_bold=1
|
||||||
|
bold_is_bright=1
|
||||||
|
scrollback_lines=100000
|
||||||
|
|
||||||
|
[colors]
|
||||||
|
#background=#181818
|
||||||
|
background=rgba(24, 24, 24, 0.8)
|
||||||
|
|
Loading…
Reference in New Issue