Compare commits

...

5 Commits

Author SHA1 Message Date
cubernetes f297ff713b pomo and much more i guess 2023-08-12 21:33:34 +02:00
cubernetes 8f915727d1 added script cut_term_width.py 2023-08-12 21:33:12 +02:00
cubernetes a17bac3bd0 xinitrc bash_xinitrc 2023-08-09 00:38:05 +02:00
cubernetes d82655349e Arch systemupdate script 2023-08-08 19:37:01 +02:00
cubernetes ddd26e0f1d Crontab 2023-08-08 19:36:34 +02:00
9 changed files with 242 additions and 16 deletions

118
.bash_xinitrc Normal file
View File

@ -0,0 +1,118 @@
#!/usr/bin/bash
# xrandr --setprovideroutputsource 1 0 --setprovideroutputsource 2 0
# Configure Displays
three-mon
# xrandr --newmode "1600x900_60.00" 119.00 1600 1696 1864 2128 900 901 904 932 -HSync +Vsync
# xrandr --addmode DVI-I-1-1 "1600x900_60.00"
# xrandr --above DP-1 --output DVI-I-1-1 --auto --mode "1600x900_60.00" --left-of DP-1
# Wallpaper Diashows
# wp-dia hor eDP-1 10m
# wp-dia wp-repo-1 HDMI-1 10m
# wp-dia wp-repo-1 DP-1 10m
# Keymap
setxkbmap -layout us
# Enable Touchpad While Typing
# xinput |
# grep Touchpad |
# awk '{print $6}' |
# sed "s/id=//" - |
# {
# read iid; xinput list-props $iid |
# grep "Typing Enabled (" |
# awk '{gsub(/\(|\)|:/,""); print $6}' |
# xargs -I 'pid' xinput set-prop $iid 'pid' 0;
# }
updatebar
######################## More or less shell specific #####################
pathappend () {
# just works
NORM_PATH=":${PATH}:"
NORM_PATH="$(printf '%s' "${NORM_PATH}" | sed 's/::/:/g')"
# TODO: Handle Slashes
NORM_PATH_TO_ADD=":${1}:"
NORM_PATH_TO_ADD="$(printf '%s' "${NORM_PATH_TO_ADD}" | sed 's/::/:/g' | sed 's/::/:/g')"
if [ "$(printf '%s' "${-}" | sed 's/r//')" = "${-}" ] && [ -d "${1}" ] && [ "$(printf '%s' "${NORM_PATH}" | sed "s/$(printf '%s' "${NORM_PATH_TO_ADD}" | awk '{gsub("\x2f", "\x5c\x2f"); print $0}')//")" = "${NORM_PATH}" ]; then
PATH="${PATH:+"${PATH%:}"}${NORM_PATH_TO_ADD%:}"
fi
}
export pathappend
ld_lib_path_add () {
# just works
NORM_PATH=":${PATH}:"
NORM_PATH="$(printf '%s' "${NORM_PATH}" | sed 's/::/:/g')"
# TODO: Handle Slashes
NORM_PATH_TO_ADD=":${1}:"
NORM_PATH_TO_ADD="$(printf '%s' "${NORM_PATH_TO_ADD}" | sed 's/::/:/g' | sed 's/::/:/g')"
if [ "$(printf '%s' "${-}" | sed 's/r//')" = "${-}" ] && [ -d "${1}" ] && [ "$(printf '%s' "${NORM_PATH}" | sed "s/$(printf '%s' "${NORM_PATH_TO_ADD}" | awk '{gsub("\x2f", "\x5c\x2f"); print $0}')//")" = "${NORM_PATH}" ]; then
PATH="${PATH:+"${PATH%:}"}${NORM_PATH_TO_ADD%:}"
fi
}
export ld_lib_path_add
eval "$(pyenv init --path)"
# shellcheck disable=SC2155
export XDG_RUNTIME_DIR=/run/user/"$(id -u)"
export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}"/ssh-agent.socket
# export SUDO_ASKPASS='/usr/bin/sudo-askpass'
# export SSH_ASKPASS='/usr/bin/sudo-askpass'
# export SSH_ASKPASS_REQUIRE='prefer'
export GIT_CONFIG_GLOBAL="${HOME}"/.gitconfig
export USER42='tischmid'
export EMAIL42='timo42@proton.me'
export MAIL='timo42@proton.me'
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
export GOPATH="${HOME}"/go
ld_lib_path_add "${LD_LIBRARY_PATH}:${HOME}/.local/lib"
export LD_LIBRARY_PATH
pathappend '/bin'
pathappend '/sbin'
pathappend '/usr/bin'
pathappend '/usr/sbin'
pathappend '/usr/local/bin'
pathappend '/usr/lcoal/sbin'
pathappend '/usr/local/games'
pathappend '/usr/games'
pathappend '/snap/bin'
pathappend "${HOME}"/bin
pathappend "${HOME}"/.local/bin
pathappend "${HOME}"/.local/include
pathappend "${HOME}"/.brew/bin
pathappend "${GOPATH}"/bin
export PATH
# add cargo bin to path
if [ -f "${HOME}"/.cargo/env ] || [ -r "${HOME}"/.cargo/env ]; then
# shellcheck disable=SC1091
. "${HOME}"/.cargo/env
fi
export NVM_DIR="${HOME}"/.nvm
# shellcheck disable=SC1091
[ -s "${NVM_DIR}"/nvm.sh ] && . "${NVM_DIR}"/nvm.sh
# shellcheck disable=SC1091
[ -s "${NVM_DIR}"/bash_completion ] && . "${NVM_DIR}"/bash_completion
######################## More or less shell specific END #####################
nohup startlxde & disown
while true ; do
dwm
sleep 0.5
done

63
.bashrc
View File

@ -85,16 +85,6 @@ alias xpaste='xsel --clipboard --output'
alias aptclean='sudo apt -y update && sudo apt -y full-upgrade &&
sudo apt -y dist-upgrade && sudo apt -y autoremove &&
sudo apt -y clean'
alias paruu=' printf "\033[30;41m%s\033[m\n" "pacman -Sy archlinux-keyring" \
&& yes | sudo pacman -Sy archlinux-keyring \
&& printf "\033[30;41m%s\033[m\n" "pacman -Syyuu --noconfirm" \
&& yes | sudo pacman -Syyuu --noconfirm \
&& printf "\033[30;41m%s\033[m\n" "paru -Syu --devel --noconfirm" \
&& yes | paru -Syu --devel --noconfirm \
&& printf "\033[30;41m%s\033[m\n" "pacman -Qtdq | pacman -Rns -" \
&& pacman -Qtdq | sudo pacman --noconfirm -Rns - \
&& printf "\033[30;41m%s\033[m\n" "########## Done #########"'
alias paruuu=' clear && time (paruu)'
alias pacman='pacman --color=auto'
alias pcker='nvim "${HOME}"/.config/nvim/lua/*/packer.lua'
alias after='nvim "${HOME}"/.config/nvim/after/plugin'
@ -122,6 +112,7 @@ alias cmatrix='cmatrix -u3 -Cred'
alias gca='git add -u && git commit -m "Automatic add"'
alias watch='watch -tcn.1'
alias pacop='clear && 2>/dev/null paco && 2>/dev/null paco --strict'
alias xterm='xterm -bg black -fg white'
alias norm='alacritty -e sh -c '\''watch -cn.5 \
norminette -R CheckForbiddenSourceHeader'\'' & disown'
alias norm2='alacritty -e sh -c '\''watch -cn.5 \
@ -130,6 +121,49 @@ alias norm2='alacritty -e sh -c '\''watch -cn.5 \
alias dotconf='git --git-dir="${HOME}"/.dotfiles/ --work-tree="${HOME}"'
2>/dev/null dotconf config status.showUntrackedFiles no
function paruuu () {
ssid="$(iw dev wlan0 link |
grep SSID |
sed -e 's/[[:blank:]]*SSID: //' \
-e 's/[[:blank:]]*$//'
)"
if : \
&& [ ! "${ssid}" = "Free Wifi" ] \
&& [ ! "${ssid}" = "FreeWifi" ] \
&& [ ! "${ssid}" = "DS_JD-Tree" ] \
&& [ ! "${ssid}" = "Haihin" ] \
&& [ ! "${ssid}" = "∞" ] \
&& [ ! "${ssid}" = "\xe2\x88\x9e" ] \
&& [ ! "${ssid}" = $'\xe2\x88\x9e' ] \
&& [ ! "${ssid}" = "Nichts 5" ] \
&& [ ! "${ssid}" = "Nichts 2,4" ] \
&& [ ! "${ssid}" = "Pink Flamingo" ] \
&& [ ! "${ssid}" = "Pink Flamingo_5G" ] \
&& [ ! "${ssid}" = "42Berlin_Student" ] \
&& [ ! "${ssid}" = "42Berlin_Guest" ] \
&& [ ! "${ssid}" = "ZorgatiHome Guest" ] \
&& [ ! "${ssid}" = "Hackme" ] \
&& : ; then
printf '\033[31m%s\033m\n' "You're connected to '${ssid}', do you want to continue?"
read X
else
clear
time (
printf "\033[30;41m%s\033[m\n" "pacman -Sy archlinux-keyring" \
&& yes | sudo pacman -Sy archlinux-keyring \
&& printf "\033[30;41m%s\033[m\n" "pacman -Syyuu --noconfirm" \
&& yes | sudo pacman -Syyuu --noconfirm \
&& printf "\033[30;41m%s\033[m\n" "paru -Syu --devel --noconfirm" \
&& yes | paru -Syu --devel --noconfirm \
&& printf "\033[30;41m%s\033[m\n" "pacman -Qtdq | pacman -Rns -" \
&& { pacman -Qtdq | 2>/dev/null sudo pacman --noconfirm -Rns - \
|| printf "\033[30;42m%s\033[m\n" "No orphan packages!"; } \
&& printf "\033[30;42m%s\033[m\n" "###### Done without error ######" \
|| printf "\033[30;41m%s\033[m\n" "###### Some error occured! ######"
)
fi
}
function skill () {
if [ -n "${1}" ] ; then
# shellcheck disable=SC2046,SC2009
@ -140,6 +174,11 @@ function skill () {
fi
}
function wpa_restart () {
skill wpa_supplicant
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
}
function bat () {
2>/dev/null command -v batcat && { batcat "${@}"; return 0; }
2>/dev/null command -v bat && { $(type -P bat) "${@}"; return 0; }
@ -322,9 +361,13 @@ fi
2>/dev/null xset -b
# sudo kbdrate --rate=30.0 --delay=250
complete -C pomo pomo
# shellcheck disable=SC1091
if [ -f "${HOME}"/.userbashrc ]; then . "${HOME}"/.userbashrc; fi
# Simplified *Bash* Prompt, e.g. for tty/system/linux console
# unset PS0; PS1='\033[94m\u\033[37m@\033[32m\h\033[37m@\033[33m$(basename -- "$(tty)") \033[36m\w \033[35m\$\033[m '
alias new_mp_project='clear && builtin cd -P ./ && python3 -m venv ./env/ && . ./env/bin/activate && pip install --no-input opencv-python mediapipe && pip freeze > ./requirements.txt && printf '\''#!/usr/bin/env python3\n\nfrom typing import NoReturn\n\nimport mediapipe as mp\nimport cv2\n\n\ndef main() -> NoReturn:\n\tpass\n\nif __name__ == '\''"'\''"'\''__main__'\''"'\''"'\'':\n\tmain()\n'\'' 1>./main.py && chmod +x ./main.py && printf '\''__pycache__/\nenv/\n'\'' 1>.gitignore && git init && git add -A && git commit -m '\''Initial commit'\'' && git ls-files && echo Done'

1
.config/crontab_tosuman Normal file
View File

@ -0,0 +1 @@
0 * * * * /home/tosuman/.local/bin/system_update.shc

View File

@ -79,7 +79,7 @@ null_ls.setup({
}
})
require("norme").setup({
-- Your configuration
cmd = os.getenv('HOME') .. '/.local/bin/norminette'
})
-- require("norme").setup({
-- -- Your configuration
-- cmd = os.getenv('HOME') .. '/.local/bin/norminette'
-- })

39
.local/bin/cut_term_width.py Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
import re
import sys
def pad_to_width(line: bytes, width: int) -> str:
output_line = b''
idx = 0
buffer = b''
while idx < len(line):
if width == 0:
break
if (match := re.match(rb'((?:\x1b\[[\d;]*\w)|[ -~])', line[idx:])):
span = match.span()
buffer += line[idx + span[0]:idx + span[1]]
idx += span[1]
if span[1] == 1:
width -= 1
output_line += buffer
buffer = b''
else:
idx += 1
output_line += b'\033[m'
return output_line.decode('utf-8')
def main() -> int:
width = int(sys.argv[1])
lines = open(0, 'rb').read().strip(b'\n').split(b'\n')
for line in lines:
try:
print(pad_to_width(line, width), file=sys.stdout, flush=True)
except Exception as error:
print('There was an error printing the line', file=sys.stderr, flush=True)
print(str(error), file=sys.stderr, flush=True)
return 1
return 0
if __name__ == '__main__':
raise SystemExit(main())

18
.local/bin/system_update.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
export PATH="${PATH}:/home/tosuman/.local/bin"
export SHELL='/usr/bin/bash'
number_of_tmux_sessions="$(tmux ls | wc -l)"
if [ "${number_of_tmux_sessions}" = "0" ] ; then
DISPLAY=:0 alacritty & disown
DISPLAY=:1 alacritty & disown
DISPLAY=:2 alacritty & disown
sleep 1
else
tmux new-window -c '/home/tosuman' &&
tmux rename-window 'System Update'
fi
tmux send-key 'paruuu' ENTER

View File

@ -1,3 +1,7 @@
#!/usr/bin/bash
# This file ought to be sourced, above line for syntax highlighting purposes.
# shellcheck disable=SC2009
if ! ps aux|grep -v grep|grep startx 1>/dev/null; then
startx 1>/home/tosuman/.startx.log 2>&1
fi
@ -6,6 +10,7 @@ fi
if [ -n "$BASH_VERSION" ] ; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ] && [ -r "$HOME/.bashrc" ]; then
# shellcheck disable=SC1091
. "$HOME/.bashrc"
fi
fi

View File

@ -11,6 +11,7 @@ bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
set-option -g escape-time 10
set -g focus-events on
bind-key r source-file "~/.tmux.conf"
# After scrolling and selecting text, don't leave copy mode
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection
@ -26,7 +27,7 @@ set -g status-left "#[bg=#fb4934,fg=#3c3836]  #{session_name} #[bg=#fe8019,fg
set -g window-status-format "#[bg=#504945] #{window_index}-#{window_name} #{?#{==:#{window_index},#{session_windows}},#[bg=#3c3836 fg=#504945],}"
set -g window-status-current-format "#[bg=#a89984,fg=#504945]#[fg=#282828] #{window_index}-#{window_name} #[bg=#504945,fg=#a89984]#{?#{==:#{window_index},#{session_windows}},#[bg=#3c3836],}"
set -g window-status-separator ""
set -g status-right "#(pwd) #[fg=#504945]#[bg=#504945,fg=#a89984] #(whoami)  #[bg=#a89984,fg=#282828] #{host_short} 󰍹 #[bg=#a89984,fg=#fe8019]#[bg=#fe8019,fg=#fb4934]#[bg=#fb4934,fg=#3c3836] #(date +%H:%M) "
set -g status-right "#(2>/dev/null pomo && 2>/dev/null pomo | grep -Fq -- '-' && 2>/dev/null 1>&2 paplay '/home/tosuman/music/Gong Sound Effect.mp3') #(pwd) #[fg=#504945]#[bg=#504945,fg=#a89984] #(whoami)  #[bg=#a89984,fg=#282828] #{host_short} 󰍹 #[bg=#a89984,fg=#fe8019]#[bg=#fe8019,fg=#fb4934]#[bg=#fb4934,fg=#3c3836] #(date +%H:%M) "
set -g status-right-length 500
set -g status-interval 1
set -g pane-base-index 1
@ -52,4 +53,4 @@ bind-key -r -T prefix C-j resize-pane -D 2
bind-key -r -T prefix C-k resize-pane -U 2
bind-key -r -T prefix C-l resize-pane -R 2
bind-key -T prefix C-u popup '/usr/local/bin/tmux_urls.py'
bind-key -T prefix C-u popup -E '~/.local/bin/tmux_urls.py'

1
.xinitrc Normal file
View File

@ -0,0 +1 @@
exec /usr/bin/bash "${HOME}"/.bash_xinitrc