snippets


useful commands/tools:

find . -type f | fzf --preview 'less {}'
ls file.py | entr python3 file.py
bcat
eza / exa
du -h -d 1 -t 300m 2>/dev/null
zmv '(*).abc' '$1.xyz'
rg (ripgrep)
alias pbcopy='xsel --input --clipboard'
alias pbpaste='xsel --output --clipboard'
pbpaste | pandoc | pbcopy
yt --transcript url | fabric -p pattern > output.md
pandoc -s input.md --metadata-title="TITLE" -o output.html
certbot certonly --webroot -w /var/www/domain.tld -d domain.tld -d www.domain.tld
zcat domain.tld.access.log.*.gz | goaccess domain.tld.access.log -
sudo addgroup --system docker sudo adduser $USER docker newgrp docker

installs:

zsh

apt install zsh zsh-autosuggestions zsh-syntax-highlighting
.zshrc:

        source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
        source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
        ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#555555'
        PROMPT='%F{#1CEC91}%n:%F{#878787}%~%B%F{#6DFF4B} >%f%b '
        autoload -U zmv
      

fzf

apt install fzf
.zshrc:

        source /usr/share/doc/fzf/examples/completion.zsh
        source /usr/share/doc/fzf/examples/key-bindings.zsh
      

middle click scrolling

xinput --list
xinput --list-props #
xinput --set-prop # 'libinput Scroll Method Enabled' 0 0 1

python

apt install python3
apt install python3-pip
apt install python3-dotenv
apt install python3.11-venv
python3 -m venv .venv
. .venv/bin/activate

MariaDB:

apt install mariadb-server

mysql_secure_installation
        Switch to unix_socket authentication [Y/n] n
        Change the root password? [Y/n] n
mariadb
        GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
        CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
        CREATE DATABASE dbname;
        GRANT ALL ON dbname.* TO 'username'@'localhost';
        FLUSH PRIVILEGES;
        exit
      
systemctl status mariadb
mysqladmin version

postgresql

apt install postgresql postgresql-contrib
su - postgres
psql

        \password postgres
        create database dbname
        create user username with encrypted password 'password';
        grant all privileges on database dbname to username;
        \c username postgres;
        grant all on schema public to username;
        
vi /etc/postgresql/15/main/pg_hba.conf
host    dbname        dbuser        185.xx.xx.xx/32       scram-sha-256
vi /etc/postgresql/15/main/postgresql.conf
listen_addresses = '*'
systemctl restart postgresql
psql -h hostname -U username -d dbname -W

django

python3 -m venv .venv
. .venv/bin/activate
pip install django
django-admin startproject projectname
python manage.py startapp appname
python manage.py createsuperuser
python manage.py makemigrations
python manage.py migrate
python manage.py runserver