Compare commits

...

17 Commits

Author SHA1 Message Date
tosu 518d6157b5 aoc template 2023-12-11 10:40:13 +01:00
tosu 3411e0e459 pomo 2023-12-06 03:36:18 +01:00
tosu b7b81aa514 simple_timer.sh 2023-12-06 03:34:37 +01:00
tosu 1276ba1908 nvim packer compiled 2023-12-06 03:30:38 +01:00
tosu 74af737669 nvim setting splitright false 2023-12-06 03:30:17 +01:00
tosu ef9d8b7144 nvim remaps 2023-12-06 03:29:55 +01:00
tosu f920279570 nvim telescope stuff 2023-12-06 03:29:25 +01:00
tosu 9ea61a708e nvim lsp stuff 2023-12-06 03:29:07 +01:00
tosu 830d615883 nvim colors 2023-12-06 03:28:38 +01:00
tosu 8e45ecfa71 alacritty.yml colors 2023-12-06 03:27:08 +01:00
tosu 2db00b4b0a history limit to 100K and M-a send-prefix 2023-12-06 03:25:44 +01:00
tosu 172cd2c550 no gpg signing git 2023-12-06 03:24:46 +01:00
tosu 0355ffe90c aoc, cdpath, ssid 2023-12-06 03:24:20 +01:00
tosu c9e51f9521 picom 2023-12-06 03:23:44 +01:00
tosu 28352cda54 update updatebar and system_update.sh 2023-12-06 03:22:49 +01:00
tosu ff4c0f6779 bluetooth pairing stuff 2023-12-06 03:21:45 +01:00
tosu 896b138589 Update crontab_tosuman 2023-12-03 06:45:08 +01:00
18 changed files with 385 additions and 81 deletions

View File

@ -114,6 +114,8 @@ export NVM_DIR="${HOME}"/.nvm
[ -s "${NVM_DIR}"/bash_completion ] && . "${NVM_DIR}"/bash_completion
######################## More or less shell specific END #####################
picom &
nohup startlxde 2>/dev/null 1>&2 & disown
while true ; do
dwm 2>>/home/tosuman/.xinit.log 1>&2

228
.bashrc
View File

@ -48,17 +48,18 @@ set -o emacs
tabs -4
shopt -s histappend
shopt -s checkwinsize
shopt -s dotglob
shopt -s extglob
shopt -u histverify
shopt -s autocd
HISTSIZE='-1'
HISTFILESIZE='-1'
HISTFILE="${HOME}"/.bash_history
HISTTIMEFORMAT=$'\033[m%F %T: '
HISTCONTROL='ignoredups:erasedups:ignorespace'
HISTCONTROL='ignoreboth:erasedups'
# PROMPT_COMMAND="history -n; history -w; history -c; history -r"
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if 2>/dev/null 1>&2 command -v nvim; then
alias v='nvim'
alias vi='nvim'
@ -81,7 +82,7 @@ alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias sudo='sudo '
alias s='eval sudo $(fc -nl -2 | head -1 | cut -c3-)' # cut -c2- for bash posix mode
alias s='echo sudo $(fc -nl -2 | head -1 | cut -c3-); eval sudo $(fc -nl -2 | head -1 | cut -c3-)' # cut -c2- for bash posix mode
alias watch='watch '
alias tmux='tmux -2'
alias open='xdg-open'
@ -94,11 +95,12 @@ alias aptclean='sudo apt -y update && sudo apt -y full-upgrade &&
alias pacman='pacman --color=auto'
alias pcker='nvim "${HOME-}"/.config/nvim/lua/*'
alias after='nvim "${HOME-}"/.config/nvim/after/plugin'
alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --time-style=long-iso -bharZ1l'
alias l='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --time-style=long-iso -bharZ1l'
# alias l='lsd --timesort --color=auto -harZ1l'
alias ll='\ls --width="${COLUMNS:-80}" --sort=time --time=mtime --color=auto --fu -bharZ1l'
alias ls='\ls --width="${COLUMNS:-80}" --color=auto -bC'
alias ip='ip --color=auto'
alias ip='ip -color=auto'
alias ipa='ip -br -color=auto a'
alias grep='grep --color=auto'
alias diff='diff --width="${COLUMNS:-80}" --color=auto'
alias less='less -SR'
@ -124,9 +126,27 @@ alias norm2='alacritty -e sh -c '\''watch -cn.5 \
norminette -R CheckForbiddenSourceHeader \| \
xargs -I{} printf \"{} \#\#\# \"'\'' & disown'
alias dotconf='git --git-dir="${HOME-}"/.dotfiles/ --work-tree="${HOME-}"'
alias r='ranger'
2>/dev/null dotconf config status.showUntrackedFiles no
# auto_pushd
function cd () {
command cd "${@}" || return 1
pwd="${PWD}"
1>/dev/null command cd - || return 1
1>/dev/null pushd "${pwd}" || return 1
}
CDPATH="${CDPATH}:${HOME}/projects"
CDPATH="${CDPATH}:${HOME}/projects/aoc"
CDPATH="${CDPATH}:${HOME}/projects/aoc/2023"
CDPATH="${CDPATH}:${HOME}/42ecole"
CDPATH="${CDPATH}:${HOME}/42ecole/42cursus"
function paruuu () {
read -p 'Do system upgrade (Y) or exit (n)' choice
if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then
exit
fi
ssid="$(iw dev wlan0 link |
grep SSID |
sed -e 's/[[:blank:]]*SSID: //' \
@ -147,41 +167,49 @@ function paruuu () {
&& [ ! "${ssid-}" = "42Berlin_Student" ] \
&& [ ! "${ssid-}" = "42Berlin_Guest" ] \
&& [ ! "${ssid-}" = "ZorgatiHome Guest" ] \
&& [ ! "${ssid-}" = "Rudolph" ] \
&& [ ! "${ssid-}" = "Hackme" ] \
&& [ ! "${ssid-}" = "hackme3" ] \
&& [ ! "${ssid-}" = "Silmaril 4 (5)" ] \
&& [ ! "${ssid-}" = "Silmaril 4 (2.4)" ] \
&& [ -n "${ssid-}" ] \
&& : ; then
printf '\033[31m%s\033m\n' "You're connected to '${ssid-}', do you want to continue?"
# shellcheck disable=SC2162
read
else
# shellcheck disable=SC2033
time (
printf '\033[30;41m%s\033[m\n' 'Cache credentials for sudo:' \
&& sudo -v \
&& printf '\033[30;41m%s\033[m\n' 'Updating mirrorlist' \
&& curl -sSL "https://archlinux.org/mirrorlist/?country=DE&protocol=https&use_mirror_status=on" \
| sed -e 's/^#Server/Server/' -e '/^#/d' \
| rankmirrors -n 8 - \
| sudo tee /etc/pacman.d/mirrorlist \
&& clear \
&& 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 -Syyu --devel --noconfirm' \
&& yes | paru -Syyu --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 pacman orphan packages :)!'; } \
&& yes | paru -Scc -d \
&& printf '\n\033[30;42m%s\033[m\n' '###### Done without error ######' \
|| printf '\n\033[30;41m%s\033[m\n' '###### Some error occured! ######'
)
read -p "You're connected to '${ssid-}', update anyway (Y|n)?" choice
if [ ! "${choice}" = "y" -a ! "${choice}" = "Y" -a -n "${choice}" ]; then
exit
fi
fi
# shellcheck disable=SC2033
time (
printf '\033[30;41m%s\033[m\n' 'Cache credentials for sudo:' \
&& sudo -v \
&& printf '\033[30;41m%s\033[m\n' 'Updating mirrorlist' \
&& curl -sSL "https://archlinux.org/mirrorlist/?country=DE&protocol=https&use_mirror_status=on" \
| sed -e 's/^#Server/Server/' -e '/^#/d' \
| rankmirrors -n 8 - \
| sudo tee /etc/pacman.d/mirrorlist \
&& clear \
&& 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 -Syyu --devel --noconfirm' \
&& yes | paru -Syyu --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 pacman orphan packages :)!'; } \
&& yes | paru -Scc -d \
&& printf '\n\033[30;42m%s\033[m\n' '###### Done without error ######' \
|| printf '\n\033[30;41m%s\033[m\n' '###### Some error occured! ######'
)
}
function skill () {
if [ -n "${1-}" ] ; then
# shellcheck disable=SC2046,SC2009
2>/dev/null kill -9 \
-- $(ps auxww | grep "${1-}" | grep -v grep | awk '{print $2}') \
&& return 0
2>/dev/null sudo kill -9 \
-- $(ps auxww | grep "${1-}" | grep -v grep | awk '{print $2}')
else
@ -222,8 +250,9 @@ function norminette () {
function __norm () {
local _pwd
return 0
_pwd="$(pwd -P)"
[ -n "${_pwd-}" ] && [ -z "${_pwd##"${HOME-}"/42/42cursus/*}" ] || { return 1; }
[ -n "${_pwd-}" ] && [ -z "${_pwd##${HOME-}/42/42cursus/*}" ] || { return 1; }
1>/dev/null 2>&1 git status || { return 2; }
1>/dev/null 2>&1 norminette && printf ' \033[92m%s\033[m' "[Norm: OK]" || printf ' \033[101;37m%s\033[m' "[䝝誒 ‼ NORM ‼ 屌誒]"
return 0
@ -280,13 +309,15 @@ if [ ! "${TERM-}" = "linux" ] ; then
export TERM='screen'
fi
fi
# shellcheck disable=SC2155
export VISUAL="$(2>/dev/null command -v nvim)"
# shellcheck disable=SC2155
export EDITOR="$(2>/dev/null command -v vim ||
2>/dev/null command -v vi ||
2>/dev/null command -v nano ||
2>/dev/null command -v ed)"
# # shellcheck disable=SC2155
# export VISUAL="$(2>/dev/null $(type -P nvim))"
export VISUAL="vi"
# # shellcheck disable=SC2155
export EDITOR="vi"
# export EDITOR="$(2>/dev/null $(type -P vim) ||
# 2>/dev/null $(type -P vi) ||
# 2>/dev/null $(type -P nano) ||
# 2>/dev/null $(type -P ed))"
export SUDO_EDITOR="${EDITOR-}"
export GIT_PS1_SHOWDIRTYSTATE='1'
export MANPAGER='nvim +Man!'
@ -294,7 +325,7 @@ export MANPAGER='nvim +Man!'
###################### PROMPT STUFF #######################
# If bash runs in posix mode, if should be `cut -c2-` instead
# If bash runs in posix mode, if should be `cut -c2-' instead
# shellcheck disable=SC2016
PS0='$(clear -x ; printf "${PS1@P}" ; fc -nl -1 | cut -c3- ; printf "\n")'
@ -385,12 +416,113 @@ 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 '
push_swap_perf () {
url="${1}"
perf_dir="${2}"
[ -z "${url}" ] && { echo "Expected two parameters (url && perf_dir)" ; return ; }
[ -z "${perf_dir}" ] && { echo "Expected two parameters (url && perf_dir)" ; return ; }
rm -rf -- "${perf_dir}" || { echo "Couldn't return" ; return ; }
git clone --quiet --depth 1 "${url}" "${perf_dir}" || { echo "Couldn't clone" ; return ; }
[ -f "./stack_a.txt" ] || { echo "File ./stack_a.txt does not exist!" ; return ; }
stack_a_file="$(readlink -f -- "./stack_a.txt")"
2>/dev/null 1>/dev/null pushd -- "${perf_dir}" || { echo "Couldn't cd into '${perf_dir}'" ; return ; }
makefile_dir="$(find . -name Makefile | awk '{printf "%s|%s\n", $0, length($0)}' | sort -t'|' -k2,2g | head -1 | awk -F'|' '{print $1}' | xargs -r dirname)"
[ -z "${makefile_dir}" ] && { echo "No Makefile found" ; return ; }
2>/dev/null 1>/dev/null pushd -- "${makefile_dir}" || { echo "Couldn't cd into '${makefile_dir}'" ; return ; }
find . -type f -exec sed -i -e 's/-Werror//g' {} \;
find . -type f -exec sed -i -e 's/rewind/rewindx/g' {} \;
2>/dev/null 1>/dev/null make -j$(nproc) -i -k -s || { echo "Couldn't run make" ; return ; }
ops="$(2>/dev/null ./push_swap $(cat -- "${stack_a_file}") | wc -l)"
echo "ops;${ops}"
2>/dev/null 1>/dev/null popd
2>/dev/null 1>/dev/null popd
}
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'
function x () {
cc -std=c89 -Wall -Wextra -pedantic -Werror -Wconversion -g3 -O0 -o main ./*.c && ./main "${@}"
rm -f ./main
}
function x2 () {
cc -std=c89 -Wall -Wextra -pedantic -Werror -Wconversion -g3 -O0 -o main ./*.c && ./main "${@}"
# Add these to your ~/.bash_aliases
AOC_DIR="${HOME}/projects/aoc" # remember to change this to whatever your AOC directory is
alias aos="python3 solution.py < in.txt"
alias aot="printf '\033[34m'; python3 solution.py < test.txt; printf '\033[m'"
alias aoc="aot; echo; aos"
aocload () {
local dir
local year
local day
this_year="$(date "+%Y")"
this_day="$(date "+%d" | sed -e 's/^0//')"
if [ -n "${1}" ]; then
if [ -z "${2}" ]; then
printf '\033[31m%s\033[m\n' 'Expected one more parameter (day)'
return 1
fi
if [ -n "${3}" ]; then
printf '\033[31m%s\033[m\n' 'Expected exactly 2 parameters (year day)'
return 2
fi
year="${1}"
day="${2}"
if [ "${day}" -lt "1" -o "${day}" -gt "25" ]; then
printf '\033[31m%s\033[m\n' 'Day not in range 1..25'
return 3
fi
if [ "${year}" -lt "2015" -o "${year}" -gt "${this_year}" ]; then
printf '\033[31m%s\033[m\n' "Year not in range 2015..${this_year}"
return 4
fi
else
year="${this_year}"
day="${this_day}"
fi
dir="${AOC_DIR}/${year}/${day}"
command mkdir -p -- "${dir}" || return 5
command cd -P -- "${dir}" || return 6
2>/dev/null 1>/dev/null git init "${AOC_DIR}" || true
. "${AOC_DIR}/.env"
curl -sSL \
-o './in.txt' \
-b "session=${AOC_COOKIE}" \
"https://adventofcode.com/${year}/day/${day}/input" \
|| printf '\033[31m%s\033[m' "$(echo 'Error downloading input' | tee './in.txt')"
command unset -v -- AOC_COOKIE
if [ ! -f './solution.py' ]; then
command cat <<- TEMPLATE >> './solution.py'
#!/usr/bin/env python3
import re
import sys
import math
import numpy as np
from functools import cache, lru_cache, reduce
from itertools import (
repeat, cycle, combinations, combinations_with_replacement,
permutations, tee, pairwise, zip_longest, islice, takewhile,
filterfalse, starmap
)
from collections import deque, defaultdict, Counter
e=enumerate
def pairs(iterable, filler=None):
a, b = tee(iterable)
next(b, None)
return islice(zip(a, b), None, None, 2))
data = open(0).read().strip()
lines = data.splitlines()
for line in lines:
line = line.split()
TEMPLATE
fi
command chmod +x './solution.py'
tmux splitw -v -c "${dir}"
tmux send-keys "nvim '+normal gg0' './in.txt'" ENTER
tmux select-pane -l
tmux send-keys "nvim './solution.py'" ENTER
}

View File

@ -152,6 +152,34 @@ colors:
cyan: '#46d9ff'
white: '#dfdfdf'
#colors:
# # Default colors
# primary:
# background: '#f2eede'
# foreground: '#000000'
#
# # normal colors
# normal:
# black: '#000000'
# red: '#cc3e28'
# green: '#216609'
# yellow: '#b58900'
# blue: '#1e6fcc'
# magenta: '#5c21a5'
# cyan: '#158c86'
# white: '#aaaaaa'
#
# # bright colors
# bright:
# black: '#555555'
# red: '#cc3e28'
# green: '#216609'
# yellow: '#b58900'
# blue: '#1e6fcc'
# magenta: '#5c21a5'
# cyan: '#158c86'
# white: '#aaaaaa'
# Visual Bell
#
# Any time the BEL code is received, Alacritty "rings" the visual bell. Once

View File

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

View File

@ -8,6 +8,7 @@ end
-- For inside
ColorMyPencils("gruvbox")
-- ColorMyPencils("habamax")
-- For outside
-- ColorMyPencils("shine")
-- ColorMyPencils("peachpuff")

View File

@ -15,6 +15,12 @@ end)
-- (Optional) Configure lua language server for neovim
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.offsetEncoding = 'utf-8'
require('lspconfig').clangd.setup{
capabilities = capabilities
}
lsp.ensure_installed({
'clangd',
'tsserver',
@ -28,13 +34,14 @@ lsp.ensure_installed({
local cmp = require('cmp')
local cmp_select = { behavior = cmp.SelectBehavior.Select }
local cmp_action = require('lsp-zero').cmp_action()
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<C-t>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
})
--
lsp.set_preferences({
sign_icons = {}
})

View File

@ -2,5 +2,5 @@ local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
builtin.grep_string({ search = vim.fn.input("Grep: ") })
end)

View File

@ -1,8 +1,8 @@
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "ca\"", "vi\"lohc")
vim.keymap.set("n", "ca'", "vi'lohc")
vim.keymap.set("n", "ca\"", "vi\"lohd")
vim.keymap.set("n", "ca'", "vi'lohd")
vim.keymap.set("n", "da\"", "vi\"lohd")
vim.keymap.set("n", "da'", "vi'lohd")
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
@ -34,15 +34,15 @@ end)
-- vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
vim.keymap.set("n", "<leader>X", "<cmd>!./%<CR>")
vim.keymap.set("n", "<leader>X", "<cmd>w<CR><cmd>!./%<CR>")
vim.keymap.set("n", "<leader>w", "<cmd>w<CR>")
vim.keymap.set("n", "<leader>q", "<cmd>wq<CR>")
vim.keymap.set("n", "<leader>P", "<cmd>w<CR><cmd>!sent *.sent<CR>")
vim.keymap.set("n", "<leader><leader>X", "<cmd>!chmod +x %<CR>")
-- vim.keymap.set("n", "<leader>P", "<cmd>w<CR><cmd>!sent *.sent<CR>")
vim.keymap.set("n", "<leader><leader>X", "<cmd>w<CR><cmd>!chmod +x %<CR><CR>")
-- vim.keymap.set("n", "<leader>x", ":w<CR>:!cc -std=c89 -Wall -Wextra -pedantic -Werror -Wconversion -g3 -O0 -o main *.c && ./main ; rm -f ./main<CR>")
-- vim.keymap.set("n", "<leader>x", ":w<CR>:!cc -std=c89 -Wall -Wextra -pedantic -Werror -Wconversion -g3 -O0 -o main *.c<CR>")
vim.keymap.set("n", "<leader>x", ":w<CR>:!cc -Wall -Wextra -pedantic -Wconversion -g3 -O0 -o main *.c && echo 'OUTPUT:' ; ./main<CR>")
vim.keymap.set("n", "<leader>x", ":w<CR>:!cc -std=c89 -Wall -Wextra -pedantic -Wconversion -g3 -O0 -o main *.c && ./main ; rm -f ./main<CR>")
-- vim.keymap.set("n", "<leader>x", ":w<CR>:!cc -std=c89 -Wall -Wextra -pedantic -Wconversion -g3 -O0 -o main *.c<CR>")
-- vim.keymap.set("n", "<leader>x", ":w<CR>:!cc -trigraphs -Wall -Wextra -pedantic -Wconversion -g3 -O0 -o main *.c && echo 'OUTPUT:' ; ./main<CR>")
vim.keymap.set("n", "<leader>c", "mz:s/\\(^\\s*\\)\\(.*$\\)/\\1\\/* \\2 *\\//g<CR>:noh<CR>`z")
vim.keymap.set("n", "<leader>C", "mz:s/\\/\\* \\(.*\\) \\*\\//\\1/g<CR>:noh<CR>`z")

View File

@ -40,6 +40,7 @@ vim.opt.updatetime = 50
vim.opt.colorcolumn = '80'
vim.opt.paste = false
vim.opt.splitright = false
-- vim.diagnostic.config({
-- virtual_lines = false,

View File

@ -49,8 +49,8 @@ local function save_profiles(threshold)
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1692616192/share/lua/5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1692616192/share/lua/5.1/?/init.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1692616192/lib/luarocks/rocks-5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1692616192/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1692616192/lib/lua/5.1/?.so"
local package_path_str = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/share/lua/5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/share/lua/5.1/?/init.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/lib/luarocks/rocks-5.1/?.lua;/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tosuman/.cache/nvim/packer_hererocks/2.1.1696795921/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end

6
.config/pomo/config.yaml Normal file
View File

@ -0,0 +1,6 @@
.started=2023-08-09T01:00:00+02:00
.duration=2m13.004180308s
.interval=
.warn=1m
.prefix=🍅
.prefixwarn=💢

View File

@ -25,4 +25,4 @@
[gpg]
program = gpg
[commit]
gpgsign = true
# gpgsign = true

9
.local/bin/connect_to_mx5.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
bluetoothctl power on \
&& bluetoothctl connect 14:3F:A6:A8:7F:CD
sleep 3
bluetoothctl connect 14:3F:A6:A8:7F:CD ||
{ sleep 3; bluetoothctl connect 14:3F:A6:A8:7F:CD; }

View File

@ -0,0 +1,81 @@
#!/bin/bash
set -euo pipefail
###################### STOP ###################
# Put device in pairing mode!!!
# MUST be uppercase
MX5_MAC="AC:80:0A:6D:F3:7B"
MX3_MAC="14:3F:A6:A8:7F:CD"
DEVICE_MAC="${MX5_MAC}"
function log () {
printf "\n\033[31m%s\033[m\n" "${@}" >/dev/tty
}
log "rfkill block bluetooth..."
rfkill block bluetooth
log "sudo rmmod btusb..."
sudo rmmod btusb
log "sudo modprobe btusb..."
sudo modprobe btusb
log "rfkill unblock bluetooth..."
rfkill unblock bluetooth
log "sudo systemctl restart bluetooth..."
sudo systemctl restart bluetooth
# echo "btmgmt"
# btmgmt
log "Waiting 3 seconds..."
sleep 3
(
log "Powering on bluetooth agent..."
cat <<- CMDS
power on
agent on
default-agent
pairable on
discoverable on
CMDS
log "Removing ${DEVICE_MAC}..."
echo "remove ${DEVICE_MAC}"
log "Turning on scanning..."
echo "scan on"
log "Waiting until ${DEVICE_MAC} is found..."
while : ; do
sleep 1
bluetoothctl devices | grep -q "${DEVICE_MAC}" && break
done
log "Found ${DEVICE_MAC}."
log "Turning off scanning..."
echo "scan off"
log "Pairing with ${DEVICE_MAC}..."
echo "trust ${DEVICE_MAC}"
echo "pair ${DEVICE_MAC}"
log "Waiting 3 seconds"
sleep 3
log "Connecting to ${DEVICE_MAC}..."
echo "connect ${DEVICE_MAC}"
log "Waiting until connected"
while : ; do
connected="0"
for mac in $(bluetoothctl devices | awk '{print $2}'); do
[ ! "${mac}" = "${DEVICE_MAC}" ] && continue
bluetoothctl info "${mac}" | grep -q "Connected: yes" && { connected="1"; break; }
done
[ "${connected}" = "1" ] && break
log "Not yet connected with ${DEVICE_MAC}."
sleep 1
done
log "Connected with ${DEVICE_MAC}."
log "Trying one more time..."
echo "connect ${DEVICE_MAC}"
log "Done."
) | bluetoothctl

29
.local/bin/simple_timer.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
min="${1-}"
sec="${2-}"
if [ -z "${min}" ] || [ -z "${sec}" ] || [ -n "${3-}" ] ; then
printf '%s\n' "Usage: ${0-} MIN SEC"
exit 1
fi
print_as_minutes () {
_total_sec="${1}"
min="$((_total_sec / 60))"
sec="$((_total_sec % 60))"
clear -x
n_lines="$(($(tput lines) / 2 - 4))"
while [ "${n_lines}" -ge "0" ] ; do
printf '\n'
n_lines="$((n_lines - 1))"
done
figlet -w "$(tput cols)" -c "${min} : ${sec}"
}
total_sec="$((min * 60 + sec))"
while [ "${total_sec}" -ge "0" ] ; do
print_as_minutes "${total_sec}"
sleep 1s
total_sec="$((total_sec - 1))"
done

View File

@ -1,18 +1,26 @@
#!/bin/sh
export PATH="${PATH}:/home/tosuman/.local/bin"
export SHELL='/usr/bin/bash'
run () {
if [ "$(date "+%H")" = "06" ] ; then
return 1
fi
sleep 10
export PATH="${PATH}:/home/tosuman/.local/bin"
export SHELL='/usr/bin/bash'
number_of_tmux_sessions="$(tmux ls | wc -l)"
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
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
tmux send-key 'paruuu' ENTER
}
run

View File

@ -74,8 +74,8 @@ getVolume() {
}
getRates() {
rxtxrates="$( (cat "${HOME}"/.datarates ; grep wlan0 /proc/net/dev) | awk '{if(l1){printf "%.3f ↑ %.3f ↓\n", ($2-l1)/1024^2*8, ($10-l2)/1024^2*8} else{l1=$2; l2=$10;}}' )"
grep wlan0 /proc/net/dev > "${HOME}/.datarates"
rxtxrates="$( (cat /tmp/.datarates ; grep wlan0 /proc/net/dev) | awk '{if(l1){printf "%.3f ↑ %.3f ↓\n", ($2-l1)/1024^2*8, ($10-l2)/1024^2*8} else{l1=$2; l2=$10;}}' )"
grep wlan0 /proc/net/dev > /tmp/.datarates
[ -n "${rxtxrates}" ] && rxtxrates="${dlm}^c#92ee791^${rxtxrates}^d^"
printf '%s' "${rxtxrates}"
}

View File

@ -36,12 +36,12 @@ set -g pane-border-status 'top'
set -g pane-border-style fg=#fb4934
set -g pane-active-border-style fg=#fb4934
# set-option -ga terminal-overrides ",xterm*:Tc"
set-option -g history-limit 50000
set-option -g history-limit 100000
# CTRL-Space instead of CTRL-B as prefix
unbind C-b
set-option -g prefix C-Space
bind-key -n C-b send-prefix
bind-key -n M-a send-prefix
bind-key -T prefix h select-pane -L
bind-key -T prefix j select-pane -D