dotfiles

Настройки и скрипты
git clone git://git.konyahin.xyz/dotfiles
Log | Files | Refs

commit 5db52ad9311a252e67693f58d459e0afe61d0129
Author: Anton Konyahin <me@konyahin.xyz>
Date:   Fri,  4 Nov 2022 20:44:09 +0300

Initial commit

Diffstat:
A.gitignore | 2++
A.stowrc | 1+
Acalendar/dot-calendar/calendar | 8++++++++
Aisync/.config/dot-mbsyncrc | 26++++++++++++++++++++++++++
Amutt/.config/mutt/aliases | 1+
Amutt/.config/mutt/mailcap | 6++++++
Amutt/.config/mutt/muttrc | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anewsboat/dot-newsboat/config | 39+++++++++++++++++++++++++++++++++++++++
Anewsboat/dot-newsboat/urls | 43+++++++++++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/add_repo.sh | 21+++++++++++++++++++++
Ascripts/dot-bin/agenda.tcl | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/articles | 14++++++++++++++
Ascripts/dot-bin/bookmark | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/git_refresh.sh | 15+++++++++++++++
Ascripts/dot-bin/git_setup.sh | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/irc-client | 46++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/passmenu | 35+++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/server_setup.sh | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ascripts/dot-bin/status.sh | 8++++++++
Ascripts/dot-bin/switchlayout | 8++++++++
Ascripts/dot-bin/vpn_setup.sh | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ash/.config/ksh/kshrc | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atask/.config/task/taskrc | 43+++++++++++++++++++++++++++++++++++++++++++
Avim/.config/vimrc | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ax11/dot-Xdefaults | 4++++
Ax11/dot-xsession | 11+++++++++++
26 files changed, 927 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +newsboat/dot-newsboat/cache.db +newsboat/dot-newsboat/history.cmdline diff --git a/.stowrc b/.stowrc @@ -0,0 +1 @@ +--dotfiles diff --git a/calendar/dot-calendar/calendar b/calendar/dot-calendar/calendar @@ -0,0 +1,8 @@ +LANG=ru_RU.UTF-8 + +#include "/home/anton/data/calendar/personal.calendar" +#include <calendar.birthday> +#include <calendar.computer> +#include <calendar.openbsd> +#include <ru_RU.UTF-8/calendar.history> +#include <ru_RU.UTF-8/calendar.orthodox> diff --git a/isync/.config/dot-mbsyncrc b/isync/.config/dot-mbsyncrc @@ -0,0 +1,26 @@ +IMAPAccount epik +Host mail.konyahin.xyz +Port 993 +UserCmd "pass mail/epik/login" +PassCmd "pass mail/epik/password" +SSLType IMAPS +# Linux +# CertificateFile /etc/ssl/certs/ca-certificates.crt +# OpenBSD +CertificateFile /etc/ssl/cert.pem + +IMAPStore epik-remote +Account epik + +MaildirStore epik-local +Path ~/data/mail/fastmail/ +Inbox ~/data/mail/fastmail/INBOX +Subfolders Verbatim + +Channel epik +Far :epik-remote: +Near :epik-local: +Create Both +Expunge Both +Patterns * +SyncState * diff --git a/mutt/.config/mutt/aliases b/mutt/.config/mutt/aliases @@ -0,0 +1 @@ +alias me Anton Konyahin <me@konyahin.xyz> diff --git a/mutt/.config/mutt/mailcap b/mutt/.config/mutt/mailcap @@ -0,0 +1,6 @@ +text/plain; more +text/html; mv %s %s.html && open %s.html +text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -dump -width=1024 %s; nametemplate=%s.html; copiousoutput; +application/octet-stream; zathura %s +application/pdf; zathura %s +image/png; feh %s diff --git a/mutt/.config/mutt/muttrc b/mutt/.config/mutt/muttrc @@ -0,0 +1,70 @@ +color header brightred black ^from +color header brightblue black ^to +color header brightcyan black ^subject +color header brightgreen black ^date + +# New mail is boldened: +color index brightyellow black "~N" + +# use a for alias adding +set alias_file = ~/.config/mutt/aliases +source ~/.config/mutt/aliases + +set mailcap_path = ~/.config/mutt/mailcap +auto_view text/html + +set header_cache = ~/data/mail/cache + +set sort = threads +# hide plus sign if line in mail too long +set markers = no +set mark_old = no + +# don't go to next message automatically +set pager_stop + +set date_format = "%d/%m" +set index_format = "[%Z] %D %-15.15F %s" + +# sidebar settings +set sidebar_visible = yes +set sidebar_width = 16 +color sidebar_new color221 color233 +set status_chars = " *%A" +set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───" + +bind index,pager <down> sidebar-next +bind index,pager <up> sidebar-prev +bind index,pager <right> sidebar-open + +# Ctrl + l for view all url from mail +macro pager \cl |urlview\n +macro index d "<enter><exit>s+Trash\n" +macro index C "<enter><exit>s+Checks\n" +macro index G "!mbsync -c ~/.config/.mbsyncrc -a\n" "Receive new mails" +bind attach <return> view-mailcap + +# RFC 3676 f=f +set text_flowed + +# disable confirmation +set delete +unset confirmappend +set quit + +# don't mark mails as old +unset mark_old + +# Settings for my mailbox +set folder = ~/data/mail/fastmail +set smtp_url = "smtps://me@konyahin.xyz@mail.konyahin.xyz:465" +set smtp_pass = "`pass mail/epik/password`" +set from = "me@konyahin.xyz" +set realname = "Anton Konyahin" + +set spoolfile = "+INBOX" +set record = "+Sent" +set trash = "+Trash" +set postponed = "+Drafts" + +mailboxes =INBOX =Sent =Trash =Drafts =Checks =Spam =Archive diff --git a/newsboat/dot-newsboat/config b/newsboat/dot-newsboat/config @@ -0,0 +1,39 @@ +bind-key j down +bind-key k up +bind-key l open +bind-key h quit +bind-key G end +bind-key g home +bind-key o open-in-browser-and-mark-read +bind-key n toggle-article-read +bind-key TAB next-unread +bind-key x delete-article +bind-key q hard-quit + +color listnormal blue default +color listfocus black yellow standout bold +color listnormal_unread cyan default +color listfocus_unread yellow default bold +color info red black bold +color article white default bold + +highlight all "---.*---" yellow +highlight article "(^Лента:.*|^Заголовок:.*|^Автор:.*|^Ссылка:.*|^Дата:.*)" cyan default bold +highlight article "https?://[^ ]+" green default +highlight article "\\[[0-9][0-9]*\\]" magenta default bold + +browser "bookmark add" +macro v set browser "nohup mpv %u > /dev/null &"; open-in-browser; set browser "browser" + +articlelist-format "║%4i %f %t" +feedlist-format "║%7u %t" + +feedlist-title-format "║ 📚 Ленты новостей (%u / %t)" +articlelist-title-format "║ 📖 Новости: %T (%u / %t)" +itemview-title-format "📰 %F: %T" + +download-full-page no +scrolloff 5 +show-keymap-hint no +show-read-articles yes +max-items 100 diff --git a/newsboat/dot-newsboat/urls b/newsboat/dot-newsboat/urls @@ -0,0 +1,43 @@ +https://lukesmith.xyz/rss.xml "~Luke Smith" +http://feeds.akkartik.name/kartiks-scrapbook?format=xml +https://danluu.com/atom.xml "~Danluu blog" +https://suckless.org/atom.xml +https://calibre-ebook.com/changelog.rss +https://nullprogram.com/feed/ +https://ounapuu.ee/posts/index.xml +https://blog.benjojo.co.uk/rss.xml +https://newsboat.org/news.atom "~Newsboat" +https://feeds2.feedburner.com/typepad/krisdedecker/lowtechmagazineenglish +https://hackaday.com/blog/feed/ +https://briancallahan.net/blog/feed.xml +https://undeadly.org/cgi?action=rss +https://xeiaso.net/blog.rss +https://jmmv.dev/feed.xml +https://pointersgonewild.com/feed/ +https://flak.tedunangst.com/rss +https://stevelosh.com/rss.xml +https://www.cambus.net/atom.xml +https://dataswamp.org/~solene/rss.xml +http://feeds.feedburner.com/TomJohnson?format=xml +https://www.rfleury.com/feed +https://konyahin.xyz/index.xml + +https://bugs.openjdk.org/sr/jira.issueviews:searchrequest-rss/temp/SearchRequest.xml?jqlQuery=project+%3D+JDK+AND+issuetype+%3D+JEP+AND+resolution+%3D+Unresolved+ORDER+BY+priority+DESC%2C+updated+DESC&tempMax=1000 + +https://news.ycombinator.com/rss +https://www.linux.org.ru/section-rss.jsp?section=2&group=4066 +https://www.linux.org.ru/section-rss.jsp?section=1 +https://old.reddit.com/r/programming.rss "~/r/programming" +https://old.reddit.com/r/java.rss "~/r/java" +https://old.reddit.com/r/coding.rss "~/r/coding" +https://old.reddit.com/r/openbsd.rss "~/r/openbsd" +https://old.reddit.com/r/avr.rss "~/r/avr" +https://old.reddit.com/r/embedded.rss "~/r/embedded" +https://old.reddit.com/r/microcontrollers.rss "~/r/microcontrollers" +https://old.reddit.com/r/electronics.rss "~/r/electronics" +https://old.reddit.com/r/arduino.rss "~/r/arduino" +https://old.reddit.com/r/C_Programming.rss "~/r/c" +https://old.reddit.com/r/lisp.rss "~/r/lisp" + +https://videos.lukesmith.xyz/feeds/videos.xml?accountId=3 +https://devzen.ru/feed/ diff --git a/scripts/dot-bin/add_repo.sh b/scripts/dot-bin/add_repo.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +set -e + +REPO=$1 + +if [ -z $REPO ] +then + echo "You should specify repository name" + exit 1 +fi + +mkdir -p /git/$REPO +cd /git/$REPO +git init --bare + +echo "Anton Konyahin" > owner +echo "git://git.konyahin.xyz/$REPO" > url +${EDITOR:-vi} description + +chown -R git:git /git/$REPO diff --git a/scripts/dot-bin/agenda.tcl b/scripts/dot-bin/agenda.tcl @@ -0,0 +1,63 @@ +#!/usr/bin/env tclsh8.6 + +array set colors { + black "\033\[1;30m" + red "\033\[1;31m" + green "\033\[1;32m" + yellow "\033\[1;33m" + blue "\033\[1;34m" + magenta "\033\[1;35m" + cyan "\033\[1;36m" + white "\033\[1;37m" + end "\033\[0m" +} + +proc print {text in color} { + global colors + puts -nonewline $colors($color) + puts -nonewline $text + puts $colors(end) +} + +if {[llength $argv] > 0 & [lindex $argv 0] eq {next}} { + set next next + set time [clock scan "next week"] +} else { + set next {} + set time [clock seconds] +} + +lassign [clock format $time -format "%W %d %m %Y"] \ + week day month year + +if {$next ne {}} { + set day -1 +} + +set calendar [open "/home/anton/data/planing/calendar.txt"] +set lines [split [read $calendar] "\n"] +close $calendar + +foreach line $lines { + # year + if {[string first "$year " $line] == 0} { + print $line in red + continue + } + # month + if {[string first "$year-$month " $line] == 0} { + print $line in yellow + continue + } + # today, print green + if {[string first "$year-$month-$day " $line] == 0} { + print $line in green + continue + } + # another days of week + if {[string first "w$week" $line] > -1 & \ + [string first "$year-" $line] == 0} { + puts $line + continue + } +} diff --git a/scripts/dot-bin/articles b/scripts/dot-bin/articles @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +count=$1 +if [ -z "$count" ] +then + count=1 +fi + +for _ in $(seq $count) +do + $BROWSER "$(bookmark get)" +done + +bookmark count diff --git a/scripts/dot-bin/bookmark b/scripts/dot-bin/bookmark @@ -0,0 +1,77 @@ +#!/usr/bin/env sh + +check_env () { + if [ -z "$(printenv "$1")" ] + then + echo "You must set \$$1 variable $2" >&2 + exit 1 + fi +} + +print_count () { + echo "Articles: $(wc -l < "$BOOKMARKS")" +} + +print_help () { + echo "bookmark - script for keeping and retrieving your bookmarks +Usage: + bookmark add \"link\" + save link in bookmark file + bookmark ls + view bookmarks list in your \$PAGER + bookmark cat + print all you bookamrks to terminal + bookmark count + show number of your bookmarks + bookmark get + get first bookmark from list +" +} + +if [ -z "$1" ] +then + print_help + exit +fi + +BOOKMARKS=~/data/bookmarks/bookmarks +TEMP=~/data/bookmarks/bookmarks.temp + +if [ "ls" = "$1" ] +then + check_env "PAGER" + $PAGER $BOOKMARKS + exit +fi + +if [ "cat" = "$1" ] +then + cat $BOOKMARKS + exit +fi + +if [ "count" = "$1" ] +then + print_count + exit +fi + +if [ "get" = "$1" ] +then + head -n 1 $BOOKMARKS + tail -n +2 $BOOKMARKS > $TEMP; mv $TEMP $BOOKMARKS + exit +fi + +if [ "add" = "$1" ] +then + if grep -qi "$2" $BOOKMARKS + then + exit 1 + fi + echo "$2" >> $BOOKMARKS + exit +fi + +echo "Unknown command" +print_help diff --git a/scripts/dot-bin/git_refresh.sh b/scripts/dot-bin/git_refresh.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +set -e + +rm -rf /var/www/htdocs/git/index.html + +cd /git/ +for repo in */ ; do + mkdir -p /var/www/htdocs/git/"$repo" + cd /var/www/htdocs/git/"$repo" + stagit /git/"$repo" +done + +cd /var/www/htdocs/git/ +stagit-index /git/* >> index.html diff --git a/scripts/dot-bin/git_setup.sh b/scripts/dot-bin/git_setup.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env sh + +set -e + +pkg_add git stagit + +user add -m git +cd /home/git +su git <<ENDGIT + +mkdir -p .ssh && chmod 700 .ssh +touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys + +cat > ~/.ssh/authorized_keys << "END" +no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILcXnswpV545z89oFFWY0YuoAIFDShZ7+OdfFTWYCbtL me@konyahin.xyz +END +ENDGIT + +chsh -s /usr/local/bin/git-shell git + +cat >> /etc/httpd.conf << "END" + +server "git.konyahin.xyz" { + listen on * tls port 443 + root "/htdocs/git" + tls { + certificate "/etc/ssl/konyahin.xyz.fullchain.pem" + key "/etc/ssl/private/konyahin.xyz.key" + } + + location "./well-known/acme-challenge/*" { + root "/acme" + request strip 2 + } +} +END + +mkdir -p /var/www/htdocs/git +chown -R git:git /var/www/htdocs/git + +httpd -n +rcctl restart httpd + +mkdir -p /git/ +chown -R git:git /git + +rcctl enable gitdaemon +rcctl set gitdaemon flags --export-all --base-path="/git" +rcctl set gitdaemon user git +rcctl start gitdaemon + +cat > /usr/local/share/git-core/templates/hooks/post-receive << "END" +#!/usr/bin/env sh + +set -e + +rm -rf /var/www/htdocs/git/index.html + +cd /git/ +for repo in */ ; do + mkdir -p /var/www/htdocs/git/$repo + cd /var/www/htdocs/git/$repo + stagit /git/$repo +done + +cd /var/www/htdocs/git/ +stagit-index /git/* >> index.html +END + +chmod +x /usr/local/share/git-core/templates/hooks/post-receive diff --git a/scripts/dot-bin/irc-client b/scripts/dot-bin/irc-client @@ -0,0 +1,46 @@ +#!/usr/bin/env sh + +set -e + +if [ -z "$1" ]; then + echo "Specify network or channel" + exit 1 +fi + +libera () { + SERVER=irc.libera.chat + PORT=6665 +} + +oftc () { + SERVER=irc.oftc.net + PORT=6667 +} + +case $1 in "libera") + libera;; +"oftc") + oftc;; +"suckless") + oftc + CHANNEL="#suckless";; +"openbsd") + libera + CHANNEL="#openbsd";; +*) + echo "Unknown network or channel: $1" + exit 1;; +esac + +PASS=$(pass irc/password) +NICK=kon4ru + +COMMAND="-s $SERVER -p $PORT -n $NICK" +if [ ! -z "$CHANNEL" ]; then + COMMAND="$COMMAND -c $CHANNEL" +fi +COMMAND="$COMMAND -x" + +kirc $COMMAND <<END +privmsg NickServ :identify $PASS +END diff --git a/scripts/dot-bin/passmenu b/scripts/dot-bin/passmenu @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu=dmenu-wl + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu + xdotool="xdotool type --clearmodifiers --file -" +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool +fi diff --git a/scripts/dot-bin/server_setup.sh b/scripts/dot-bin/server_setup.sh @@ -0,0 +1,107 @@ +#!/usr/bin/env sh + +set -e + +rcctl disable httpd +rcctl stop httpd + +cat > /etc/acme-client.conf << "END" +authority letsencrypt { + api url "https://acme-v02.api.letsencrypt.org/directory" + account key "/etc/acme/letsencrypt-privkey.pem" +} + +authority letsencrypt-staging { + api url "https://acme-staging-v02.api.letsencrypt.org/directory" + account key "/etc/acme/letsencrypt-staging-privkey.pem" +} + +authority buypass { + api url "https://api.buypass.com/acme/directory" + account key "/etc/acme/buypass-privkey.pem" + contact "mailto:me@konyahin.xyz" +} + +authority buypass-test { + api url "https://api.test4.buypass.no/acme/directory" + account key "/etc/acme/buypass-test-privkey.pem" + contact "mailto:me@konyahin.xyz" +} + +domain konyahin.xyz { + alternative names { www.konyahin.xyz git.konyahin.xyz vpn.konyahin.xyz } + domain key "/etc/ssl/private/konyahin.xyz.key" + domain full chain certificate "/etc/ssl/konyahin.xyz.fullchain.pem" + sign with letsencrypt +} +END + +mkdir -p -m 700 /etc/acme +mkdir -p -m 700 /etc/ssl/acme/private +mkdir -p -m 755 /var/www/acme + +cat > /etc/httpd.conf << "END" +server "konyahin.xyz" { + listen on * port 80 + root "/htdocs/konyahin.xyz" + location "/.well-known/acme-challenge/*" { + root "/acme" + request strip 2 + } +} + +server "www.konyahin.xyz" { + listen on * port 80 + block return 301 "http://konyahin.xyz$REQUEST_URI" +} +END + +httpd -n +rcctl enable httpd +rcctl start httpd +acme-client -v konyahin.xyz + +cat > /etc/httpd.conf << "END" +server "konyahin.xyz" { + listen on * tls port 443 + root "/htdocs/konyahin.xyz" + tls { + certificate "/etc/ssl/konyahin.xyz.fullchain.pem" + key "/etc/ssl/private/konyahin.xyz.key" + } + + location "./well-known/acme-challenge/*" { + root "/acme" + request strip 2 + } +} + +server "www.konyahin.xyz" { + listen on * tls port 443 + tls { + certificate "/etc/ssl/konyahin.xyz.fullchain.pem" + key "/etc/ssl/private/konyahin.xyz.key" + } + block return 301 "https://konyahin.xyz$REQUEST_URI" +} + +server "konyahin.xyz" { + listen on * port 80 + alias "www.konyahin.xyz" + block return 301 "https://konyahin.xyz$REQUEST_URI" +} +END + +mkdir -p /var/www/htdocs/konyahin.xyz +cat > /var/www/htdocs/konyahin.xyz/index.html << "END" +<html> + <body> + Test test + </body> +</html> +END + +httpd -n +rcctl restart httpd + +(crontab -l 2>/dev/null; echo "05 3 * * * acme-client example.com && rcctl reload httpd") | crontab - diff --git a/scripts/dot-bin/status.sh b/scripts/dot-bin/status.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +set -e + +while true; do + xsetroot -name "$(date '+ %A %H:%M %Y')" + sleep 2 +done diff --git a/scripts/dot-bin/switchlayout b/scripts/dot-bin/switchlayout @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +LAYOUT=$(setxkbmap -query | grep layout | awk '{print $2}') +if [ $LAYOUT = 'us' ]; then + setxkbmap ru +else + setxkbmap us +fi diff --git a/scripts/dot-bin/vpn_setup.sh b/scripts/dot-bin/vpn_setup.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env sh + +set -e + +sysctl net.inet.ip.forwarding=1 +sysctl net.inet.ipcomp.enable=1 +sysctl net.inet.esp.enable=1 +sysctl net.inet.esp.udpencap=1 + +cat >> /etc/sysctl.conf << "END" + +net.inet.ip.forwarding=1 +net.inet.ipcomp.enable=1 +net.inet.esp.enable=1 +net.inet.esp.udpencap=1 +END + +cat > /etc/hostname.enc0 << "END" +inet 10.0.1.1 255.255.255.0 10.0.1.255 +up +END + +sh /etc/netstart + +echo "user name:" +read NAME +echo "user password:" +read PASSWORD + +cat > /etc/iked.conf << "END" +server_ip = "185.92.220.211" +dns1 = "1.1.1.1" +dns2 = "8.8.8.8" + +user "$NAME" "$PASSWORD" + +ikev2 "responder_eap" passive esp \ + from 0.0.0.0/0 to 10.0.1.0/24 \ + from 10.0.0.0/24 to 10.0.1.0/24 \ + local egress peer any \ + ikesa enc aes-256 prf hmac-sha2-256 auth hmac-sha2-256 group modp2048 \ + childsa enc aes-256 auth hmac-sha2-256 group modp2048 \ + srcid konyahin.xyz \ + eap "mschap-v2" \ + config protected-subnet 0.0.0.0/0 \ + config address 10.0.1.0/24 \ + config name-server $dns1 \ + config name-server $dns2 \ + tag "ROADW" +END + +cat >> /etc/pf.conf << "END" + +wan = vio0 +vpn = enc0 +match out on $wan inet nat-to ($wan:0) +pass in quick on $wan inet proto udp from any to ($wan:0) port {500, 4500} keep state label ipsec +pass in quick on $vpn inet keep state (if-bound) +END + +pfctl -f /etc/pf.conf + +cp /etc/ssl/private/konyahin.xyz.key /etc/iked/private/local.key + +csplit -s -fcerts /etc/ssl/konyahin.xyz.fullchain.pem /BEGIN/ {0} +mv certs00 /etc/iked/certs/konyahin.xyz.crt +mv certs01 /etc/iked/ca/ca.crt + +echo 'iked_flags=""' >> /etc/rc.conf.local +rcctl enable iked +rcctl start iked diff --git a/sh/.config/ksh/kshrc b/sh/.config/ksh/kshrc @@ -0,0 +1,68 @@ +export PATH=$PATH:~/.bin:~/.local/bin +export LC_ALL=ru_RU.UTF-8 +export LANG=ru_RU.UTF-8 +export LANGUAGE=ru_RU.UTF-8 + +export NAME='Anton Konyahin' +export EMAIL='me@konyahin.xyz' + +export EDITOR=nvi +export PAGER=less +export BROWSER=open +export PASSWORD_STORE_DIR="$HOME/data/pass" + +set -o emacs +HISTCONTROL=ignoredups:ignorespace +HISTSIZE=1000 +HISTFILE=$HOME/.ksh_history +PS1='${USER}@\h:\W\$ ' + +# vim +export MYVIMRC='~/.config/vimrc' +export VIMINIT='source $MYVIMRC' + +alias z='zathura' +alias e=$EDITOR +alias v='bat' +alias nb='newsboat && bookmark count' +alias m='mutt' +alias isync='mbsync -c ~/.config/.mbsyncrc -a' + +alias scratch='$EDITOR ~/data/notes/scratch.md' + +alias esh='$EDITOR ~/.config/ksh/kshrc' +alias evi='$EDITOR ~/.nexrc' +alias evim="$EDITOR $MYVIMRC" +alias enb='$EDITOR ~/.newsboat/config' +alias enbu='$EDITOR ~/.newsboat/urls' + +alias ef='$EDITOR $(ls -R | fzf)' +alias et='$EDITOR -t $(cat tags | awk "{print \$1}" | fzf)' +alias en='$EDITOR $(find ~/data/notes -type f | fzf)' + +alias t='task' +alias ta='task add' +alias tl='task list' +alias tt='task +todo' +tmaybe () { + task $1 modify -todo +maybe +} +ttodo () { + task $1 modify -maybe +todo +} + +me () { + $EDITOR $(make 2>&1 | grep '^.*\.[ch]:' | fzf | awk -F: '{printf "-c %s %s\n", $2, $1}') +} + +alias music-dl='youtube-dl -f "bestaudio[ext=m4a]"' + +alias reload='. ~/.config/ksh/kshrc' + +# autocomplete +set -A complete_git -- pull push clone checkout status commit clean restore diff +set -A complete_sttemp -- $(ls ~/project/templates) + +# agenda +calendar +task tag:todo minimal | head -6 diff --git a/task/.config/task/taskrc b/task/.config/task/taskrc @@ -0,0 +1,43 @@ +# [Created by task 2.6.1 6/23/2022 22:56:57] +# Taskwarrior program configuration file. +# For more documentation, see https://taskwarrior.org or try 'man task', 'man task-color', +# 'man task-sync' or 'man taskrc' + +# Here is an example of entries that use the default, override and blank values +# variable=foo -- By specifying a value, this overrides the default +# variable= -- By specifying no value, this means no default +# #variable=foo -- By commenting out the line, or deleting it, this uses the default + +# You can also refence environment variables: +# variable=$HOME/task +# variable=$VALUE + +# Use the command 'task show' to see all defaults and overrides + +# Files +data.location=/home/anton/data/task + +# To use the default location of the XDG directories, +# move this configuration file from ~/.taskrc to ~/.config/task/taskrc and uncomment below + +#data.location=~/.local/share/task +hooks.location=~/.config/task/hooks + +color.tag.todo=magenta + +# Color theme (uncomment one to use) +#include light-16.theme +#include light-256.theme +#include dark-16.theme +#include dark-256.theme +#include dark-red-256.theme +#include dark-green-256.theme +#include dark-blue-256.theme +#include dark-violets-256.theme +#include dark-yellow-green.theme +#include dark-gray-256.theme +#include dark-gray-blue-256.theme +#include solarized-dark-256.theme +#include solarized-light-256.theme +#include no-color.theme +news.version=2.6.0 diff --git a/vim/.config/vimrc b/vim/.config/vimrc @@ -0,0 +1,70 @@ +set nocompatible + +set incsearch +set ignorecase +set smartcase + +set number +set relativenumber + +set scrolloff=8 + +syntax on + +set backspace=indent,eol,start + +filetype plugin indent on +set tabstop=4 +set shiftwidth=4 +set expandtab + +set smartindent + +" search for files in subdirectories, use :find to open files with partial +" match, use * for fuzzy search, use :b for mae same with open buffers +set path+=** +set wildmenu + +" soft line breaks +set fo+=w + +" string length visible limit +set colorcolumn=80 + +let mapleader="'" +inoremap <leader><leader> <Esc>/<++><Enter>"_c4l +noremap <leader>q :bd<CR> + +" snippets +" Tcl +autocmd FileType tcl inoremap <leader>f foreach ! <++> {<Enter><++><Enter>}<Esc>?!<Enter>xi +autocmd FileType tcl map <leader>3 :s/^/#/<Enter>j +autocmd FileType tcl map <leader># :s/^#//<Enter>j + +" C-] jump to tag +" gC-] for ambiguous tags +" C-t jump back +command! Tags !ectags -R . +" add : to isKeyword class of characters, because I want to jump to tags with +" colons in name +set isk+=: + +" sentence should be separate with two spaces +set cpo+=J + +" :make in shell file will triger spellcheck and show all errors (:cl) +autocmd FileType sh :set makeprg=shellcheck\ -f\ gcc\ % + +" add "===" heading below current line +nnoremap <leader>1 yypVr= + +" SPLITS +" open vertical split and switch to them +nnoremap <leader>w <C-w>v<C-w>l +nnoremap <C-h> <C-w>h +nnoremap <C-j> <C-w>j +nnoremap <C-k> <C-w>k +nnoremap <C-l> <C-w>l + +" X11 +autocmd FileType xdefaults autocmd BufWritePost * !xrdb <afile> diff --git a/x11/dot-Xdefaults b/x11/dot-Xdefaults @@ -0,0 +1,4 @@ +! $OpenBSD: dot.Xdefaults,v 1.3 2014/07/10 10:22:59 jasper Exp $ +XTerm*loginShell:true + +XIdle.timeout: 300 diff --git a/x11/dot-xsession b/x11/dot-xsession @@ -0,0 +1,11 @@ +export LC_ALL=ru_RU.UTF-8 +export LANG=ru_RU.UTF-8 +export LANGUAGE=ru_RU.UTF-8 + +export ENV=$HOME/.config/ksh/kshrc + +setxkbmap -option ctrls:nocaps + +xidle & +status.sh & +exec dwm