removed bash and added mkshrc

This commit is contained in:
davidovski 2022-05-16 00:48:34 +01:00
parent 1406e81f40
commit 381aaffe4e
14 changed files with 260 additions and 17 deletions

View file

@ -0,0 +1,78 @@
" Vim syntax file
" Language: Hare
if exists("b:current_syntax")
finish
endif
syn case match
syn keyword hareKeyword let const fn def type static export defer _
syn keyword hareBranch for return break continue yield
syn keyword hareConditional if else match switch
syn keyword hareLabel case
syn keyword hareBuiltin len offset free alloc assert append abort delete insert
syn keyword hareBuiltin vastart vaarg vaend
syn keyword hareOperator is as
syn match hareType "\vsize((\_\s|//.*)*\()@!"
syn match hareBuiltin "\vsize((\_\s|//.*)*\()@="
syn match harePreProc "^use .*;"
syn match harePreProc "@[a-z]*"
syn match hareOperator "\.\.\." "\.\."
syn region hareString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+
syn region hareString start=+`+ end=+`+
"adapted from c.vim
"integer number, or floating point number without a dot and with "f".
syn match hareNumbers display transparent "\v<\d" contains=hareNumber,hareOctal,hareBinary,hareFloat
syn match hareNumber display contained "\v\d+(e[-+]?\d+)?(z|[iu](8|16|32|64)?)?"
"hex number
syn match hareNumber display contained "\v0x\x+(z|[iu](8|16|32|64)?)?"
"octal number
syn match hareOctal display contained "\v0o\o+(z|[iu](8|16|32|64)?)?"
"binary number
syn match hareBinary display contained '\v0b[01]+(z|[iu](8|16|32|64)?)?'
syn match hareFloat display contained "\v\d+(e[-+]?\d+)?(f32|f64)"
"floating point number, with dot, optional exponent
syn match hareFloat display contained "\v\d+\.\d+(e[-+]?\d+)?(f32|f64)?"
syn match hareSpaceError display excludenl "\v\s+$"
syn match hareSpaceError display "\v +\t"me=e-1
syn keyword hareTodo contained TODO FIXME XXX
syn region hareComment start="//" end="$" contains=hareTodo,@Spell
syn keyword hareType u8 u16 u32 u64 i8 i16 i32 i64
syn keyword hareType uint int
syn keyword hareType uintptr
syn keyword hareType f32 f64
syn keyword hareType bool
syn keyword hareType char str
syn keyword hareType void
syn keyword hareType struct union
syn keyword hareType enum
syn keyword hareType nullable
syn keyword hareType rune
syn keyword hareType valist
syn keyword hareNull null
syn keyword hareBoolean true false
hi def link hareBinary Number
hi def link hareBoolean Boolean
hi def link hareBranch Repeat
hi def link hareBuiltin Function
hi def link hareComment Comment
hi def link hareConditional Conditional
hi def link hareFloat Number
hi def link hareKeyword Keyword
hi def link hareLabel Label
hi def link hareNull Constant
hi def link hareNumber Number
hi def link hareOctal Number
hi def link hareOperator Operator
hi def link harePreProc PreProc
hi def link hareString String
hi def link hareTodo Todo
hi def link hareType Type
hi def link hareSpaceError Error
" vim: tabstop=8 shiftwidth=2 expandtab

56
mkshrc Normal file
View file

@ -0,0 +1,56 @@
#!/bin/mksh
case $- in
*i*) ;;
*) return;;
esac
export VIMINIT="source ~/.config/vim/vimrc"
export NVIMINIT="source ~/.config/vim/vimrc"
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
[ -f ~/.sh_aliases ] && . ~/.sh_aliases
[ -f ~/.profile ] && . ~/.profile
# parse the current branch and status of git to be added to the prompt
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo " [${BRANCH}${STAT}]"
else
echo ""
fi
}
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
[ "${renamed}" == "0" ] && bits=">${bits}"
[ "${ahead}" == "0" ] && bits="*${bits}"
[ "${newfile}" == "0" ] && bits="+${bits}"
[ "${untracked}" == "0" ] && bits="?${bits}"
[ "${deleted}" == "0" ] && bits="x${bits}"
[ "${dirty}" == "0" ] && bits="!${bits}"
[ ! "${bits}" == "" ] && echo " ${bits}" || echo ""
}
bind '^L=clear-screen'
export PS1=$(echo -e "\e[0;97m\${PWD/#\$HOME/\~}\e[0;37m\`parse_git_branch\` > \e[0;0m")

View file

@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
feh --force-aliasing --bg-fill ~/.config/bg feh --force-aliasing --bg-tile ~/.config/dither.png
#feh --force-aliasing --bg-fill ~/.config/bg

View file

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
MAIN_DP=DP-2; MAIN_DP=DP-0;
v=$(xrandr --current --verbose | grep "Brightness" | cut -f2 -d " " | tr '\n' '*' | rev | cut -c 2- | rev | sed -e "s/$/==1/" | bc -l | grep -q 0 && echo 1 || echo 0); xrandr | grep " connected" | cut -f1 -d " " | while read -r line; do echo $line | grep -q $MAIN_DP && : || xrandr --output $line --brightness $v; done v=$(xrandr --current --verbose | grep "Brightness" | cut -f2 -d " " | tr '\n' '*' | rev | cut -c 2- | rev | sed -e "s/$/==1/" | bc -l | grep -q 0 && echo 1 || echo 0); xrandr | grep " connected" | cut -f1 -d " " | while read -r line; do echo $line | grep -q $MAIN_DP && : || xrandr --output $line --brightness $v; done

View file

@ -42,9 +42,9 @@ _fzf_bash_completion_flatten_subshells() {
printf '%s\n' "$line$buffer" printf '%s\n' "$line$buffer"
buffer= buffer=
fi fi
done < <(tac) done < <(cat)
printf '%s\n' "$buffer" printf '%s\n' "$buffer"
) | tac ) | cat
} }
_fzf_bash_completion_find_matching_bracket() { _fzf_bash_completion_find_matching_bracket() {

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
MAIN_DP=DP-2; MAIN_DP=DP-0;
v=$1 v=$1

10
scripts/links-launcher Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
startpage=${1:-https://search.davidovski.xyz/}
bin="$(which links || which xlinks)"
[ "${#DISPLAY}" = "0" ] || opts="-g -html-g-text-color 0xf58f44 -html-g-background-color 0x191919 -font /home/david/.fonts/ttf-mononoki/mononoki-Regular.ttf"
$bin $opts $startpage

View file

@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
i3lock-fancy -p -t '' #i3lock-fancy -p -t ''
slock

View file

@ -1,2 +1,3 @@
#!/bin/sh #!/bin/sh
printf "suspend\nreboot\npoweroff\nhibernate" | rofi -dmenu -p "systemctl" | xargs -r systemctl printf "suspend\nreboot\npoweroff\nhibernate" | rofi -dmenu -p "systemctl" | xargs -r systemctl

19
scripts/record_window.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
info=/tmp/wminfo
xwininfo > /tmp/wminfo
geom=$(cat $info | grep "geometry" | cut -d' ' -f4)
width=$(cat $info | grep Width | cut -d' ' -f4)
height=$(cat $info | grep Height | cut -d' ' -f4)
size="${width}x${height}"
position=+$(echo $geom | cut -d'+' -f2- | sed "s/+/,/g")
filename=$(date +"$HOME/pics/screenshot/%F_%T.mp4")
echo $size and $position
ffmpeg -y -f x11grab -video_size $size -i $position $filename
rm $info

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
maim -su /dev/stdout | tee >(xclip -selection clipboard -t image/png) > $(date +"$HOME/pics/screenshot/%F_%T.png") maim -su /dev/stdout | tee $(date +"$HOME/pics/screenshot/%F_%T.png") | xclip -selection clipboard -t image/png

View file

@ -9,10 +9,10 @@ tablet_ratio = (lambda s: float(s[0]) / float(s[1]))(sys.argv[4].split(":")) if
#Layout of screens: (x, y, w, h) #Layout of screens: (x, y, w, h)
screens = [ screens = [
(3840, 0, 1080, 1920),
(1280, 0, 2560, 1440),
(4920, 0, 1080, 1920),
(0, 0, 1280, 1024), (0, 0, 1280, 1024),
(1280, 0, 2560, 1440),
(3840, 0, 1080, 1920),
(4920, 0, 1080, 1920),
] ]
#TODO find this with xrandr #TODO find this with xrandr

View file

@ -1,14 +1,17 @@
#!/bin/sh #!/bin/sh
browser="links-launcher"
SEARCH_ENGINE="https://search.brave.com/search?q=" SEARCH_ENGINE="https://librex.beparanoid.de/search.php?q="
SEARCH_HISTORY=/tmp/.search_history SEARCH_HISTORY=$HOME/.local/share/search_history
SEARCH=$(cat $SEARCH_HISTORY | dmenu -p "search") SEARCH=$(cat $SEARCH_HISTORY | dmenu -p "search")
touch $SEARCH_HISTORY echo "$SEARCH" >> $SEARCH_HISTORY
cat <<< "$SEARCH query=$(echo $SEARCH | sed 's/ /+/g')
$(cat $SEARCH_HISTORY)" > $SEARCH_HISTORY
brave "$SEARCH_ENGINE$SEARCH" echo $query | grep -q '(?=^.{5,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)' && {
links-launcher "$query"
} || {
links-launcher "$SEARCH_ENGINE$query"
}

74
sh_aliases Normal file
View file

@ -0,0 +1,74 @@
alias l="ls -lah"
alias cls="clear"
alias cp="cp -v"
alias gif-for-cli="gif-for-cli -l 0 -c █ --display-mode=truecolor"
alias cdu="cdu -s -dh"
alias dclock="tput civis; watch -t -n1 \"date +%T|toilet --font mono12\""
alias blank="tput civis ; clear ; read"
alias open="xdg-open 2>/dev/null"
alias sl="ls"
alias resettabletscale='tablet 8 156 1 4:3'
#alias settabletscale="tablet 8 156 2.5063 4:3"
alias settabletscale="tablet 18 155 2 4:3"
alias gosumemory-default="sudo /home/david/.local/share/gosumemory/gosumemory -path /home/david/.local/share/osu-wine/OSU/Songs"
alias yta="yt-dlp --no-mtime --add-metadata --no-check-certificate -x -f bestaudio/best"
alias suspend="i3lock-fancy -p -t ''; systemctl suspend"
alias vim="nvim"
#alias tablet2='tablet 18 156 2.4'
rfc() { (for f in */; do du -a "$f" | tail -n+2 | wc -l | xargs printf "%s\t$f\n" ; done) | sort -Vr ;}
pandoc-md () {
pandoc --pdf-engine=xelatex --variable mainfont="Arial" --variable sansfont=Arial --from markdown -o `basename $1`.pdf $1
}
mp4-gif () {
ffmpeg -i $1 -r 15 -vf "scale=360:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" $2
}
alias zth="zathura"
alias nb="nb --blog-dir $BLOG_DIR"
alias looking-glass-client="looking-glass-client -G input:rawMouse=yes input:escapekey=119 input:autocapture=yes -k -j"
alias show-keymap="vim qmk_firmware/keyboards/ergo42/keymaps/iksvo/keymap.c"
configure () {
vim ~/.config/$1
}
bitrate () {
mediainfo Aphrodite_-_Superman_\(dnb\).mp3 | grep 'Bit rate '
}
alias syncdir="sudo rsync -rv --no-perms --no-owner --no-group --delete"
alias chromium-tor="chromium --incognito --proxy-server=socks5://localhost:9050 --user-data-dir=/tmp/tor"
alias chromium-i2p="chromium --incognito --proxy-server=socks5://localhost:4447 --user-data-dir=/tmp/i2p"
alarmclock () {
sudo rtcwake -m no -t "$(date -d 'tomorrow 07:00:00' '+%s')" && echo 'set alarm for tomorrow at 7am'
}
# does tail -f on a dir... bit of a hack
# i spelled this wrong on purpose i think
mutlitail1 () {
while true; do
f=$(ls -1 --sort time $@| head -1 | xargs realpath);
tail -$(tput lines) $f;
done;
}
alias watchdirty="watch grep -e Dirty: -e Writeback: /proc/meminfo"
passthrough_disable () {
sudo mv /etc/modprobe.d/vfio.conf /etc/modprobe.d/vfio.conf.disabled
}
passthrough_enable () {
sudo mv /etc/modprobe.d/vfio.conf /etc/modprobe.d/vfio.conf.disabled
}
alias links="xlinks -g -html-g-text-color 0xf58f44 -html-g-background-color 0x191919 -font /home/david/.fonts/ttf-mononoki/mononoki-Regular.ttf"