commit 73d6e3d7af2dc466fe4c9b1ef429ff37f7a52d21
parent de6c8ebde01294c16eec080b247818bb1d9745e8
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 3 Dec 2018 14:57:46 +0100
Merge branch 'master' of gitlab.com:admesg/dotfiles
Diffstat:
8 files changed, 197 insertions(+), 23 deletions(-)
diff --git a/init/00_arch.sh b/init/00_arch.sh
@@ -0,0 +1,171 @@
+#!/usr/bin/env bash
+
+# Derived from @LukeSmithxyz's LARBS script
+# License: GPLv3+
+
+set -e
+
+aurhelper=yay
+progsfile="progs/arch.csv"
+
+function info_msg {
+ echo -e "$(tput setaf 4)Info:$(tput sgr0) $*"
+}
+function warn_msg {
+ (>&2 echo -e "$(tput setaf 3)Warning:$(tput sgr0) $*")
+}
+function error_msg {
+ (>&2 echo -e "$(tput setaf 1)Error:$(tput sgr0) $*")
+}
+
+if [ "$(whoami)" != "root" ]; then
+ error "00_arch.sh must be run as root. Bye."
+ exit
+fi
+
+function prepare {
+ mount -o remount,size=2G /run/archiso/cowspace
+ pacman -Syuu --noconfirm --needed dialog
+}
+
+function confirm {
+ dialog --title "Start install" --yesno "Configure Arch Linux?" \
+ 6 60 || { clear; exit; }
+}
+
+function refreshkeys { \
+ info --infobox "Refreshing Arch Keyring"
+ pacman --noconfirm -Sy archlinux-keyring &>/dev/null
+}
+
+function newperms { # Set special sudoers settings for install (or after).
+ sed -i "/# 00_arch.sh/d" /etc/sudoers
+ echo -e "$* # 00_arch.sh" >> /etc/sudoers
+}
+
+function getuserandpass {
+ name=$(dialog --inputbox "Please enter a name for the user account." \
+ 10 60 3>&1 1>&2 2>&3 3>&1) || exit
+ namere="^[a-z_][a-z0-9_-]*$"
+ while ! [[ "${name}" =~ ${namere} ]]; do
+ name=$(dialog --no-cancel \
+ --inputbox "Username not valid. Give a username beginning \
+ with a letter, with only lowercase letters, - or _." \
+ 10 60 3>&1 1>&2 2>&3 3>&1)
+ done
+ pass1=$(dialog --no-cancel --passwordbox \
+ "Enter a password for that user." 10 60 3>&1 1>&2 2>&3 3>&1)
+ pass2=$(dialog --no-cancel --passwordbox \
+ "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
+ while ! [[ "${pass1}" == "${pass2}" ]]; do
+ unset pass2
+ pass1=$(dialog --no-cancel --passwordbox \
+ "Passwords do not match.\\n\\nEnter password again." \
+ 10 60 3>&1 1>&2 2>&3 3>&1)
+ pass2=$(dialog --no-cancel --passwordbox \
+ "Retype password." 10 60 3>&1 1>&2 2>&3 3>&1)
+ done
+}
+
+function adduserandpass {
+ info "Adding user \"$name\""
+ useradd -m -g wheel -s /bin/bash "$name" &>/dev/null ||
+ usermod -a -G wheel "$name" && \
+ mkdir -p /home/"$name" && chown "$name":wheel /home/"$name"
+ echo "$name:$pass1" | chpasswd
+ unset pass1 pass2
+}
+
+function systembeepoff {
+ info "Disable pcspeaker beep sound"
+ rmmod pcspkr
+ echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf
+}
+
+function resetpulse {
+ info "Reseting Pulseaudio"
+ killall pulseaudio
+ sudo -n "$name" pulseaudio --start
+}
+
+function serviceinit {
+ for service in "$@"; do
+ info "Enabling \"$service\"..."
+ systemctl enable "$service"
+ systemctl start "$service"
+ done
+}
+
+function manualinstall { # Installs $1 manually if not installed. Used only for AUR helper here.
+ [[ -f /usr/bin/$1 ]] || (
+ info "Manually installing \"$1\", an AUR helper..."
+ cd /tmp
+ rm -rf /tmp/"$1"*
+ curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz &&
+ sudo -u "$name" tar -xvf "$1".tar.gz &>/dev/null &&
+ cd "$1" && sudo -u "$name" makepkg --noconfirm -si &>/dev/null &&
+ cd /tmp)
+}
+
+gitmakeinstall() {
+ dir=$(mktemp -d)
+ info "Installing \`$(basename "$1")\` ($n of $total) via \`git\` and \
+ \`make\`. $(basename "$1") $2"
+ git clone --depth 1 "$1" "$dir" &>/dev/null
+ cd "$dir" || exit
+ make &>/dev/null
+ make install &>/dev/null
+ cd /tmp
+}
+
+function maininstall() { # Installs all needed programs from main repo.
+ info "Installing \`$1\` ($n of $total). $1 $2"
+ pacman --noconfirm --needed -S "$1" &>/dev/null
+}
+
+function aurinstall {
+ info "Installing \`$1\` ($n of $total) from the AUR. $1 $2"
+ grep "^$1$" <<< "$aurinstalled" && return
+ sudo -u "$name" "$aurhelper" -S --noconfirm "$1" &>/dev/null
+}
+
+function installationloop {
+ ([ -f "$progsfile" ] && cp "$progsfile" /tmp/progs.csv) || curl -Ls "$progsfile" > /tmp/progs.csv
+ total=$(wc -l < /tmp/progs.csv)
+ aurinstalled=$(pacman -Qm | awk '{print $1}')
+ while IFS=, read -r tag program comment; do
+ n=$((n+1))
+ case "$tag" in
+ "") maininstall "$program" "$comment" ;;
+ "A") aurinstall "$program" "$comment" ;;
+ "G") gitmakeinstall "$program" "$comment" ;;
+ esac
+done < /tmp/progs.csv
+}
+
+
+
+prepare
+confirm
+getuserandpass
+adduserandpass
+refreshkeys
+
+pacman --noconfirm --needed -S base-devel &>/dev/null
+
+manualinstall "$aurhelper"
+installationloop
+
+serviceinit NetworkManager cronie
+
+# This line, overwriting the `newperms` command above will allow the user to run
+# serveral important commands, `shutdown`, `reboot`, updating, etc. without a
+# password.
+newperms "%wheel ALL=(ALL) ALL\\n%wheel ALL=(ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/packer -Syu,/usr/bin/packer -Syyu,/usr/bin/systemctl restart NetworkManager,/usr/bin/rc-service NetworkManager restart,/usr/bin/pacman -Syyu --noconfirm,/usr/bin/loadkeys,/usr/bin/yay,/usr/bin/pacman -Syyuw --noconfirm"
+
+# Make pacman and yay colorful because why not.
+sed -i "s/^#Color/Color/g" /etc/pacman.conf
+
+systembeepoff
+
+info "Arch install script complete"
diff --git a/init/30_macos_recipes.sh b/init/30_macos_recipes.sh
@@ -76,6 +76,7 @@ brews=(
surfraw # cmd-line interface to search engines (`sr` alias)
the_silver_searcher # ag
task # taskwarrior
+ task-spooler # ts command
tmux
translate-shell # provides `trans` interface to google translate
tig # git history
diff --git a/init/progs/arch.csv b/init/progs/arch.csv
diff --git a/links/.config/mps-youtube/config b/links/.config/mps-youtube/config
Binary files differ.
diff --git a/links/.ncmpcpp/bindings b/links/.ncmpcpp/bindings
@@ -362,6 +362,10 @@ def_key "h"
#
#def_key "f"
# seek_forward
+def_key "f"
+ seek_forward
+def_key "F"
+ seek_backward
#
#def_key "b"
# seek_backward
diff --git a/links/.newsboat/config b/links/.newsboat/config
@@ -1,5 +1,3 @@
-# https://newsboat.org/releases/2.12/docs/newsboat.html#_first_steps
-
bind-key i quit
bind-key j next
bind-key k prev
@@ -17,6 +15,8 @@ bind-key | pipe-to
bind-key ^U pageup
bind-key ^D pagedown
bind-key SPACE macro-prefix
+bind-key ] next-feed
+bind-key [ prev-feed
unbind-key J
unbind-key K
@@ -28,7 +28,6 @@ unbind-key end
max-items 1000
history-limit 0 # do not store search queries
-browser open
bookmark-cmd "~/bin/bookmark"
show-read-feeds no # toggle view with 'l'
auto-reload yes
@@ -54,3 +53,16 @@ highlight article "^(Title):" red default
highlight article "^(Date):" cyan default
highlight feedlist "https?://[^ ]+" default default bold
+# macro prefix is ,
+#browser linkhandler
+browser open
+macro , open-in-browser
+# macro t set browser "tsp youtube-dl --add-metadata -ic"; open-in-browser ; set browser linkhandler
+# macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser linkhandler
+# macro v set browser "setsid nohup mpv"; open-in-browser ; set browser linkhandler
+macro t set browser "ts youtube-dl --add-metadata -ic"; open-in-browser ; set browser open
+macro a set browser "ts youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser open
+macro v set browser "ts nohup mpv"; open-in-browser ; set browser open
+macro w set browser "w3m"; open-in-browser ; set browser open
+# macro p set browser "dmenuhandler"; open-in-browser ; set browser linkhandler
+# macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler
diff --git a/links/.newsboat/urls b/links/.newsboat/urls
@@ -1,6 +1,5 @@
http://feeds.feedburner.com/coldhardfacts?format=xml "Misc"
http://www.jspowerhour.com/comics.rss "Misc"
-http://blogs.adobe.com/lightroomjournal/feed "Misc"
http://www.smbc-comics.com/rss.php "Misc"
http://www.threewordphrase.com/rss.xml "Misc"
https://what-if.xkcd.com/feed.atom "Misc"
@@ -10,26 +9,15 @@ http://www.democracynow.org/democracynow.rss "News"
https://stallman.org/rss/rss.xml "News"
https://www.35mmc.com/feed/ "Photography"
https://www.youtube.com/feeds/videos.xml?channel_id=UC8Pksdbj37CdE00kmE7Z1dw "Photography"
-http://feeds.feedburner.com/adorama/FlzD "Photography"
-http://www.bhphotovideo.com/explora/photography.xml "Photography"
-http://www.lonelyspeck.com//www.lonelyspeck.com/feed/ "Photography"
-https://emulsive.org/feed "Photography"
https://www.japancamerahunter.com/feed/ "Photography"
-http://leicarumors.com/feed/ "Photography"
http://www.lenswork.com/podcast.xml "Photography"
http://www.lensworkonline.com/recentadditions.xml "Photography"
https://luminous-landscape.com/feed/ "Photography"
-http://macfilos.com/photo?format=rss "Photography"
http://martinbluhm.zenfolio.com/blog.rss "Photography"
-http://www.mirrorlessons.com/feed/ "Photography"
http://phillipreeve.net/blog/feed/ "Photography"
-http://www.streethunters.net/feed/ "Photography"
-http://blog.kasson.com/feed/ "Photography"
-http://www.verybiglobo.com/feed/ "Photography"
http://lenspire.zeiss.com/en/feed/ "Photography"
http://www.igsoc.org/rss/annals64_new.xml "Research"
http://www.journals.elsevier.com/computers-and-geosciences/rss/ "Research"
-https://www.journals.elsevier.com/computers-and-geotechnics/rss "Research"
http://rss.sciencedirect.com/publication/science/0012821X "Research"
http://onlinelibrary.wiley.com/rss/journal/10.1002/(ISSN)1096-9837 "Research"
http://www.earth-surf-dynam.net/xml/rss2_0.xml "Research"
@@ -51,7 +39,6 @@ http://www.journals.elsevier.com/powder-technology/rss/ "Research"
http://feeds.aps.org/rss/tocsec/PRE-Computationalphysics.xml "Research"
http://feeds.aps.org/rss/tocsec/PRE-Fluiddynamics.xml "Research"
http://feeds.aps.org/rss/tocsec/PRE-Granularmaterials.xml "Research"
-http://www.projectmidas.org/feed.xml "Research"
http://www.journals.elsevier.com/quaternary-science-reviews/rss "Research"
http://www.sciencemag.org/rss/current.xml "Research"
http://rss.sciencedirect.com/publication/science/02773791 "Research"
@@ -62,7 +49,6 @@ http://feeds.arstechnica.com/arstechnica/index "Tech"
https://micronews.debian.org/feeds/feed.rss "Tech"
http://www.debian.org/News/news "Tech"
http://geodatahub.dk/feed.xml "Tech"
-https://cloud.google.com/feeds/compute-engine-security-bulletins.xml "Tech"
http://www.daemonology.net/hn-daily/index.rss "Tech"
http://imapfw.offlineimap.org/feed.xml "Tech"
https://blog.kitware.com/feed/ "Tech"
diff --git a/links/bin/newsboat-sync b/links/bin/newsboat-sync
@@ -16,10 +16,10 @@ else
ssh-add -l | grep -q '\.ssh/id_rsa' || ssh-add
fi
-info "Downloading newest cache..."
-rsync -aq -e 'ssh -q' ad@idkfa.ucsd.edu:~/.newsboat/cache.db ~/.newsboat/cache.db
-info "done.\\n"
+# info "Downloading newest cache..."
+# rsync -aq -e 'ssh -q' andersdc@adamsgaard.dk:~/.newsboat/cache.db ~/.newsboat/cache.db
+# info "done.\\n"
newsboat
-info "Uploading local cache..."
-rsync -aq -e 'ssh -q' ~/.newsboat/cache.db ad@idkfa.ucsd.edu:~/.newsboat/cache.db
-info "done.\\n"
+# info "Uploading local cache..."
+# rsync -aq -e 'ssh -q' ~/.newsboat/cache.db andersdc@adamsgaard.dk:~/.newsboat/cache.db
+# info "done.\\n"