Compare commits

...

5 Commits

9 changed files with 227 additions and 66 deletions

View File

@ -2,10 +2,12 @@ alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias rs='rsync --progress -v'
alias rs='rsync --progress -vur '
alias up='sudo apt update && sudo apt upgrade'
alias upnodock='sudo apt-mark hold docker-ce docker-ce-cli && sudo apt update && sudo apt upgrade && sudo apt-mark unhold docker-ce docker-ce-cli'
alias cat='bat'
alias rg='ripgrep'
alias ll='ls -ahlF'
alias la='ls -Ah'
alias l='ls -CF'
@ -37,8 +39,9 @@ alias dvl='docker volume ls'
alias dip="docker container inspect -f '{{ .NetworkSettings.IPAddress }}'" # call with <container name> or ID
alias dih="docker container inspect -f '{{ .Config.Hostname }}'" # call with <container name> or ID
alias dstats="docker stats "'$(sudo docker ps -aq)' # shows stats thingy for all containers
alias drmsc="docker container ls -a | grep Exited | awk '{print $1}' | xargs docker container rm" # removes stopped containers
alias drmdi="docker image remove "'$(docker image ls -q -f dangling=true)' # removes non-tagged images
alias drmsc="docker container prune"
alias drmdi="docker image prune"
# docker swarm
alias dss='docker stack services '

13
.bashrc
View File

@ -20,7 +20,7 @@ fi
# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you dont want to commit.
for file in ~/.{aliases,bash_prompt,functions,path,dockerfunc,extra,exports}; do
for file in ~/.{aliases,bash_prompt,functions,path,dockerfunc,extra,exports,fzf-key-bindings.bash}; do
[[ -r "$file" ]] && [[ -f "$file" ]] && source "$file"
done
unset file
@ -114,3 +114,14 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
. "$HOME/.cargo/env"
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
# ssh-add
fi
# BEGIN_KITTY_SHELL_INTEGRATION
if test -n "$KITTY_INSTALLATION_DIR" -a -e "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; then source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; fi
# END_KITTY_SHELL_INTEGRATION

96
.fzf-key-bindings.bash Normal file
View File

@ -0,0 +1,96 @@
# ____ ____
# / __/___ / __/
# / /_/_ / / /_
# / __/ / /_/ __/
# /_/ /___/_/ key-bindings.bash
#
# - $FZF_TMUX_OPTS
# - $FZF_CTRL_T_COMMAND
# - $FZF_CTRL_T_OPTS
# - $FZF_CTRL_R_OPTS
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS
# Key bindings
# ------------
__fzf_select__() {
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"}"
eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" $(__fzfcmd) -m "$@" | while read -r item; do
printf '%q ' "$item"
done
echo
}
if [[ $- =~ i ]]; then
__fzfcmd() {
[[ -n "$TMUX_PANE" ]] && { [[ "${FZF_TMUX:-0}" != 0 ]] || [[ -n "$FZF_TMUX_OPTS" ]]; } &&
echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"
}
fzf-file-widget() {
local selected="$(__fzf_select__)"
READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}$selected${READLINE_LINE:$READLINE_POINT}"
READLINE_POINT=$(( READLINE_POINT + ${#selected} ))
}
__fzf_cd__() {
local cmd dir
cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type d -print 2> /dev/null | cut -b3-"}"
dir=$(eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS" $(__fzfcmd) +m) && printf 'cd -- %q' "$dir"
}
__fzf_history__() {
local output
output=$(
builtin fc -lnr -2147483648 |
last_hist=$(HISTTIMEFORMAT='' builtin history 1) perl -n -l0 -e 'BEGIN { getc; $/ = "\n\t"; $HISTCMD = $ENV{last_hist} + 1 } s/^[ *]//; print $HISTCMD - $. . "\t$_" if !$seen{$_}++' |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort,ctrl-z:ignore $FZF_CTRL_R_OPTS +m --read0" $(__fzfcmd) --query "$READLINE_LINE"
) || return
READLINE_LINE=${output#*$'\t'}
if [[ -z "$READLINE_POINT" ]]; then
echo "$READLINE_LINE"
else
READLINE_POINT=0x7fffffff
fi
}
# Required to refresh the prompt after fzf
bind -m emacs-standard '"\er": redraw-current-line'
bind -m vi-command '"\C-z": emacs-editing-mode'
bind -m vi-insert '"\C-z": emacs-editing-mode'
bind -m emacs-standard '"\C-z": vi-editing-mode'
if (( BASH_VERSINFO[0] < 4 )); then
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard '"\C-t": " \C-b\C-k \C-u`__fzf_select__`\e\C-e\er\C-a\C-y\C-h\C-e\e \C-y\ey\C-x\C-x\C-f"'
bind -m vi-command '"\C-t": "\C-z\C-t\C-z"'
bind -m vi-insert '"\C-t": "\C-z\C-t\C-z"'
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard '"\C-r": "\C-e \C-u\C-y\ey\C-u"$(__fzf_history__)"\e\C-e\er"'
bind -m vi-command '"\C-r": "\C-z\C-r\C-z"'
bind -m vi-insert '"\C-r": "\C-z\C-r\C-z"'
else
# CTRL-T - Paste the selected file path into the command line
bind -m emacs-standard -x '"\C-t": fzf-file-widget'
bind -m vi-command -x '"\C-t": fzf-file-widget'
bind -m vi-insert -x '"\C-t": fzf-file-widget'
# CTRL-R - Paste the selected command from history into the command line
bind -m emacs-standard -x '"\C-r": __fzf_history__'
bind -m vi-command -x '"\C-r": __fzf_history__'
bind -m vi-insert -x '"\C-r": __fzf_history__'
fi
# ALT-C - cd into the selected directory
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
fi

View File

@ -27,3 +27,5 @@
helper = cache
[color]
ui = true
[pull]
rebase = true

View File

@ -42,6 +42,8 @@ bindsym $mod+d exec dmenu_run
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
bindsym Ctrl+Shift+l exec i3lock-fancy
bindsym $mod+o exec gnome-calculator
# bindsym $mod+b exec ~/clickit.sh
# change focus
bindsym $mod+j focus left

View File

@ -32,7 +32,7 @@ This function should only modify configuration layer settings."
;; List of configuration layers to load.
dotspacemacs-configuration-layers
'(
'(systemd
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press `SPC f e R' (Vim style) or
@ -50,10 +50,10 @@ This function should only modify configuration layer settings."
html
latex
markdown
org
(org :variables
org-enable-roam-support t)
plantuml
python
ranger
rust
shell
shell-scripts
@ -247,9 +247,9 @@ It should only modify the values of Spacemacs settings."
dotspacemacs-default-font '("DejaVu Sans Mono"
:size 11
:weight normal
:width normal
:powerline-scale 1.0)
;; The leader key
:width normal)
;; The leader key (default "SPC")
dotspacemacs-leader-key "SPC"
;; The key used for Emacs commands `M-x' (after pressing on the leader key).
@ -468,7 +468,7 @@ It should only modify the values of Spacemacs settings."
;; performance issues, instead of calculating the frame title by
;; `spacemacs/title-prepare' all the time.
;; (default "%I@%S")
dotspacemacs-frame-title-format "%I@%S"
dotspacemacs-frame-title-format "%I@%t %f (%p)"
;; Format specification for setting the icon title format
;; (default nil - same as frame-title-format)
@ -515,7 +515,7 @@ It should only modify the values of Spacemacs settings."
dotspacemacs-home-shorten-agenda-source nil
;; If non-nil then byte-compile some of Spacemacs files.
dotspacemacs-byte-compile t))
dotspacemacs-byte-compile nil))
(defun dotspacemacs/user-env ()
"Environment variables setup.
@ -562,32 +562,57 @@ you should place your code here."
(setq org-agenda-files
(quote ("~/Documents/Org/tasks.org"
"~/Documents/Org/journal.org"
"~/Documents/Org/private.org"
"~/Documents/Org/projects.org"
"~/Documents/Org/watchlist.org"
"~/Documents/Org/birthdays.org")))
(defun fschl/create-org-letter ()
"Create a new letter in ~/Documents/letters/ with filename and date"
(interactive)
(let ((name (read-string "Filename: ")))
(expand-file-name (format "%s.org" name) "~/Documents/letters/") ))
;; https://orgmode.org/manual/Template-elements.html
;; https://orgmode.org/manual/Template-expansion.html
(setq org-capture-templates
'(("t" "todo list item" ; name
entry ; type
(file+headline org-default-notes-file "Tasks")
"* TODO %?\n DEADLINE: %^T") ; template
("T" "todo list item with source" ; name
entry ; type
(file+headline org-default-notes-file "Tasks")
"* TODO %?\n %a \n DEADLINE: %^T \n %i") ; template
'(("t" "todo list item" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
"* TODO %?\n SCHEDULED: %^T"
:tree-type month
)
("T" "todo list item with source" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
"* TODO %?\n %a \n SCHEDULED: %^T \n %^G \n"
:tree-type month
)
("m" "scheduled meeting" ; name
entry ; type
(file+headline org-default-notes-file "Tasks")
"* MEETING %?\n SCHEDULED: %^T\n %a") ; template
("r" "Todo research some website/software" entry
(file+olp+datetree "~/Documents/Org/tasks.org")
"* TODO %?\n SCHEDULED: %^T \n %^L \n"
:tree-type month
)
("l" "letter to Documents/letters/<datetime.org>"
entry (file fschl/create-org-letter)
"* %? \n\n * \n\n "
)
("m" "Schedule a meeting" entry
(file+headline "~/Documents/Org/tasks.org")
"* MEETING %?\n SCHEDULED: %^T\n %a"
)
("p" "phone call" ; name
entry ; type
(file+headline org-default-notes-file "Tasks")
"* PHONE %?\n %i\n %a") ; template
("p" "Schedule a phone call" entry
(file+headline "~/Documents/Org/tasks.org")
"* PHONE %?\n SCHEDULED: %^T\\n %a"
)
("a" "Articles"
entry (file+weektree "~/Documents/Org/journal.org")
"* %? \n%x \n %u\n- $?")
("a" "Articles: keep notes of online articles"
entry
(file+datetree "~/Documents/Org/journal.org")
"* %? \n%x \n %u\n- $?"
:tree-type month
:kill-buffer t
:empty-lines-before 1)
)
)

14
restic-cheatsheet.org Normal file
View File

@ -0,0 +1,14 @@
* Restic - backups
https://restic.readthedocs.io/en/stable/
- init repo :: ~restic init --repo <path>~
- backup :: ~restic -r <path> --verbose backup <path>~
- restore :: ~restic -r <path> restore <ID/latest> --target /tmp/restore-work~
- restore latest via path :: ~restic -r <path> restore latest --path "somepath"~
- list snapshots :: ~restic -r <path> snapshots~
- copy snapshots between repos :: with filtering
#+begin_src bash
restic -r <sourcerepo> copy --repo2 <targetrepo> --path <path> <ID/latest>
#+end_src

View File

@ -102,12 +102,12 @@ base_applications() {
zip \
--no-install-recommends
$SUDO restic self-update
echo "... DONE... cleaning up\n\n"
$SUDO apt autoremove
$SUDO apt autoclean
$SUDO apt clean
restic self-update
}
@ -199,8 +199,8 @@ install_workstation_apps() {
DEBIAN_FRONTEND=noninteractive
apt update
apt install -y \
$SUDO apt update
$SUDO apt install -y \
alsa-tools \
alsa-utils \
aspell \
@ -237,6 +237,7 @@ install_workstation_apps() {
--no-install-recommends
TARGET="/home/$USERNAME/.emacs.d"
rm -rf ${TARGET}
git clone https://github.com/syl20bnr/spacemacs "${TARGET}"
# rm -rf "${TARGET}"/private/snippets
# git clone https://github.com/AndreaCrotti/yasnippet-snippets "${TARGET}"/private/yas-snippets
@ -295,35 +296,40 @@ install_i3() {
DEBIAN_FRONTEND=noninteractive
apt update
apt install -y \
$SUDO apt update
$SUDO apt install -y \
feh \
fswebcam \
i3 \
i3lock \
i3lock-fancy \
i3status \
lightdm \
network-manager-gnome \
network-manager-vpnc \
network-manager-vpnc-gnome \
remmina \
rxvt-unicode-256color \
rxvt-unicode \
scrot \
shotwell \
slim \
suckless-tools \
vlc \
xdotool \
xorg \
--no-install-recommends
cat <<-EOF > /usr/share/dbus-1/services/org.freedesktop.Notifications.service
[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/notification-daemon/notification-daemon
EOF
# for f in (); do
# ln -s $f /home/$USER/$f
# done
# $SUDO cat <<-EOF > /usr/share/dbus-1/services/org.freedesktop.Notifications.service
# [D-BUS Service]
# Name=org.freedesktop.Notifications
# Exec=/usr/lib/notification-daemon/notification-daemon
#EOF
echo "... setting capslock to control"
sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard
$SUDO sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard
}
@ -333,25 +339,25 @@ install_syncthing() {
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
# Add the "stable" channel to your APT sources:
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
cat "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
# pin the correct apt repo
printf "Package: *\nPin: origin apt.syncthing.net\nPin-Priority: 990\n" | sudo tee /etc/apt/preferences.d/syncthing
# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing
$SUDO apt-get update
$SUDO apt-get install syncthing
echo "... DONE... cleaning up\n\n"
apt autoremove
apt autoclean
apt clean
$SUDO apt autoremove
$SUDO apt autoclean
$SUDO apt clean
echo "enable and start the syncthing per-user service for ${USERNAME}"
cp ../etc/systemd/system/syncth* /etc/systemd/system/
$SUDO cp ../etc/systemd/system/syncth* /etc/systemd/system/
user=${USERNAME}
sudo systemctl daemon-reload
sudo systemctl enable syncthing@${USERNAME}
sudo systemctl start syncthing@${USERNAME}.service
$SUDO systemctl daemon-reload
$SUDO systemctl enable syncthing@${USERNAME}
$SUDO systemctl start syncthing@${USERNAME}.service
systemctl status syncthing@${USERNAME}.service
}
@ -363,8 +369,8 @@ install_vscodium() {
echo 'deb https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/repos/debs/ vscodium main' | sudo tee --append /etc/apt/sources.list.d/vscodium.list
apt update
apt install -y \
$SUDO apt update
$SUDO apt install -y \
codium \
--no-install-recommends
@ -379,14 +385,15 @@ install_wine() {
# https://wiki.winehq.org/Debian
curl https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor > /etc/apt/trusted.gpg.d/winehq.gpg
echo 'deb https://dl.winehq.org/wine-builds/debian/ bullseye main' | sudo tee --append /etc/apt/sources.list.d/wine.list
echo 'deb https://dl.winehq.org/wine-builds/debian/ bookworm main' | sudo tee /etc/apt/sources.list.d/wine.list
apt update
apt install \
$SUDO sudo dpkg --add-architecture i386
$SUDO apt update
$SUDO apt install \
winehq-staging \
--no-install-recommends
--install-recommends
wine version
wine --version
}
@ -398,7 +405,7 @@ install_docker() {
echo "installing docker binary Version $VERS ..."
# https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
apt install -y \
$SUDO apt install -y \
apt-transport-https \
ca-certificates \
curl \
@ -415,12 +422,12 @@ install_docker() {
# deb [arch=amd64] https://download.docker.com/linux/debian buster nightly
EOF
apt update
apt install -y \
$SUDO apt update
$SUDO apt install -y \
docker-ce \
--no-install-recommends
addgroup ${USERNAME} docker
$SUDO addgroup ${USERNAME} docker
docker version
docker info
@ -454,7 +461,7 @@ install_compose() {
install_virtualbox() {
# https://wiki.debian.org/VirtualBox#Installation_of_non-free_edition
apt install -y \
$SUDO apt install -y \
apt-transport-https \
ca-certificates \
curl \

View File

@ -77,3 +77,4 @@ if ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
. "$HOME/.cargo/env"