Initial commit of nixos config
This commit is contained in:
parent
f067c9cd37
commit
ed36644143
Binary file not shown.
Before Width: | Height: | Size: 584 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 551 KiB |
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
Binary file not shown.
Before Width: | Height: | Size: 805 KiB |
|
@ -1,5 +0,0 @@
|
||||||
! Exchange Alt and Win
|
|
||||||
clear Mod1
|
|
||||||
clear Mod4
|
|
||||||
add Mod4 = Alt_L Alt_R
|
|
||||||
add Mod1 = Super_L Super_R
|
|
|
@ -1,111 +0,0 @@
|
||||||
!! OCT-2017
|
|
||||||
|
|
||||||
!! Colors
|
|
||||||
#define blk #141517
|
|
||||||
#define bblk #969896
|
|
||||||
#define red #cc6666
|
|
||||||
#define bred #de935f
|
|
||||||
#define grn #b5bd68
|
|
||||||
#define bgrn #757d28
|
|
||||||
#define ylw #f0c674
|
|
||||||
#define bylw #f9a03f
|
|
||||||
#define blu #81a2be
|
|
||||||
#define bblu #2a8fed
|
|
||||||
#define mag #b294bb
|
|
||||||
#define bmag #bc77a8
|
|
||||||
#define cyn #8abeb7
|
|
||||||
#define bcyn #a3685a
|
|
||||||
#define wht #c5c8c6
|
|
||||||
#define bwht #ffffff
|
|
||||||
#define bg blk
|
|
||||||
#define fg wht
|
|
||||||
|
|
||||||
*.foreground: fg
|
|
||||||
*.background: bg
|
|
||||||
*.cursorColor: mag
|
|
||||||
|
|
||||||
*.color0: blk
|
|
||||||
*.color8: bblk
|
|
||||||
*.color1: red
|
|
||||||
*.color9: bred
|
|
||||||
*.color2: grn
|
|
||||||
*.color10: bgrn
|
|
||||||
*.color3: ylw
|
|
||||||
*.color11: bylw
|
|
||||||
*.color4: blu
|
|
||||||
*.color12: bblu
|
|
||||||
*.color5: mag
|
|
||||||
*.color13: bmag
|
|
||||||
*.color6: cyn
|
|
||||||
*.color14: bcyn
|
|
||||||
*.color7: wht
|
|
||||||
*.color15: bwht
|
|
||||||
|
|
||||||
! greys
|
|
||||||
*.color234: #1d2021
|
|
||||||
*.color235: #282828
|
|
||||||
*.color236: #32302f
|
|
||||||
*.color237: #3c3836
|
|
||||||
*.color239: #504945
|
|
||||||
*.color240: #544c49
|
|
||||||
*.color241: #665c54
|
|
||||||
|
|
||||||
|
|
||||||
!! Settings
|
|
||||||
! font rendering
|
|
||||||
!Xft.hinting: 0
|
|
||||||
!Xft.antialias: 1
|
|
||||||
!Xft.autohint: 1
|
|
||||||
Xft.hintstyle: hintslight
|
|
||||||
Xft.lcdfilter: lcddefault
|
|
||||||
Xft.rgba: rgb
|
|
||||||
|
|
||||||
! cursor
|
|
||||||
Xcursor.theme: default
|
|
||||||
Xcursor.size: 32
|
|
||||||
|
|
||||||
! emacs
|
|
||||||
Emacs.toolBar: 0
|
|
||||||
Emacs.menuBar: 0
|
|
||||||
Emacs.verticalScrollBars: off
|
|
||||||
|
|
||||||
! urxvt
|
|
||||||
URxvt*.background: [96]blk
|
|
||||||
URxvt*.termName: xterm-256color
|
|
||||||
URxvt*.geometry: 81x20
|
|
||||||
URxvt*.buffered: true
|
|
||||||
URxvt*.cursorBlink: true
|
|
||||||
URxvt*.underlineColor: grey
|
|
||||||
URxvt*.depth: 32
|
|
||||||
URxvt*.borderless: 1
|
|
||||||
! URxvt*.lineSpace: 1
|
|
||||||
! URxvt*.letterSpace: 0
|
|
||||||
URxvt.iso14755: false
|
|
||||||
URxvt.iso14755_52: false
|
|
||||||
URxvt*.internalBorder: 14
|
|
||||||
URxvt*.scrollBar: false
|
|
||||||
URxvt*.saveLines: 5000
|
|
||||||
URxvt*.loginShell: false
|
|
||||||
URxvt.perl-ext-common: default,matcher
|
|
||||||
URxvt*.matcher.button: 1
|
|
||||||
URxvt*.matcher.rend.0: Uline Bold fg5
|
|
||||||
URxvt*.url-launcher: firefox
|
|
||||||
!URxvt.keysym.Shift-Control-C: perl:clipboard:copy
|
|
||||||
!URxvt.keysym.Shift-Control-V: perl:clipboard:paste
|
|
||||||
URxvt.clipboard.autocopy: true
|
|
||||||
|
|
||||||
! URxvt*.font: xft:kakwa kakwafont:pixelsize=12
|
|
||||||
! urxvt-scratch.font: xft:Misc Tamsyn:pixelsize=16
|
|
||||||
! urxvt-fuzzy.font: xft:Misc Tamsyn:pixelsize=18
|
|
||||||
! urxvt-fuzzy.boldFont: xft:Misc Tamsyn:pixelsize=18
|
|
||||||
! urxvt-fuzzy.lineSpace: 4
|
|
||||||
|
|
||||||
urxvt-stream.lineSpace: 0
|
|
||||||
urxvt-stream.letterSpace: -1
|
|
||||||
urxvt-stream.font: xft:Fira Mono:pixelsize=17
|
|
||||||
|
|
||||||
URxvt*.lineSpace: 0
|
|
||||||
URxvt*.letterSpace: -1
|
|
||||||
URxvt*.font: xft:Fira Mono:pixelsize=11
|
|
||||||
urxvt-scratch.font: xft:Fira Mono:pixelsize=16
|
|
||||||
urxvt-fuzzy.font: xft:Fira Mono:pixelsize=20
|
|
|
@ -1,63 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
source ${0:A:h}/../../deploy
|
|
||||||
|
|
||||||
install() {
|
|
||||||
if ! nc -z 8.8.8.8 53 >/dev/null 2>&1; then
|
|
||||||
>&2 echo "No internet connection"
|
|
||||||
return 1
|
|
||||||
elif ! sudo pacman -Syu --noconfirm; then
|
|
||||||
>&2 echo "Could not update pacman"
|
|
||||||
return 2
|
|
||||||
elif ! _is_callable yay; then
|
|
||||||
>&2 echo "Could not find pacaur"
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
yay --needed --noconfirm -S \
|
|
||||||
xorg-server xorg-xrandr xorg-xinit xorg-xlsfonts xorg-xfd xdotool \
|
|
||||||
lightdm lightdm-mini-greeter \
|
|
||||||
bspwm sxhkd compton dunst xcb-proto polybar libnotify \
|
|
||||||
rvxt-unicode rvxt-unicode-terminfo \
|
|
||||||
slop feh maim ffmpeg zbar \
|
|
||||||
keybase-bin pass pass-otp \
|
|
||||||
neofetch glances inxi dfc youtube-dl \
|
|
||||||
ttf-fira-{mono,sans} ttf-font-awesome tamsyn-font siji-git \
|
|
||||||
arc-gtk-theme qt5-styleplugins \
|
|
||||||
evince
|
|
||||||
|
|
||||||
xdg-mime default evince.desktop application/pdf
|
|
||||||
|
|
||||||
# install crontab
|
|
||||||
crontab ./crontab
|
|
||||||
|
|
||||||
# raise inotify limit
|
|
||||||
sudo tee -a /etc/sysctl.d/99-sysctl.conf <<<"fs.inotify.max_user_watches=524288"
|
|
||||||
|
|
||||||
# set up lightdm + minigreeter
|
|
||||||
sudo systemctl enable lightdm
|
|
||||||
sudo sed -i \
|
|
||||||
-e "s@^#?\(greeter-session=\).+@\1lightdm-mini-greeter@" \
|
|
||||||
-e "s@^#?\(user-session=\).+@\1bspwm@" \
|
|
||||||
/etc/lightdm/lightdm.conf
|
|
||||||
sudo sed -i \
|
|
||||||
-e "s@^\(user = \).+@\1${USER}@" \
|
|
||||||
-e "s@^\(show-password-label = \).+@\1false@" \
|
|
||||||
-e "s@^\(background-color = \).+@\1\"#000000\"@;" \
|
|
||||||
/etc/lightdm/lightdm-mini-greeter.conf
|
|
||||||
}
|
|
||||||
|
|
||||||
# update() {}
|
|
||||||
|
|
||||||
link() {
|
|
||||||
mklink xprofile ~/.xprofile
|
|
||||||
mklink config/* $XDG_CONFIG_HOME/
|
|
||||||
mklink fonts/* $XDG_DATA_HOME/fonts/
|
|
||||||
mklink -s etc/pacman/*.hook /etc/pacman.d/hooks/
|
|
||||||
}
|
|
||||||
|
|
||||||
clean() {
|
|
||||||
rm -fv $XDG_DATA_HOME/fonts/*(@N)
|
|
||||||
sudo rm -fv /etc/pacman.d/hooks/*(@N)
|
|
||||||
}
|
|
||||||
|
|
||||||
init "$@"
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# A shim to make firefox believe HOME is elsewhere
|
|
||||||
HOME="$XDG_DATA_HOME/mozilla" exec /usr/bin/firefox "$@"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
firefox --private-window "$@"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /usr/bin/notify-send "$@"
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
xcolor() {
|
|
||||||
xrdb -query | awk "/^\*\.$1:/ {print \$2}" | sed -E 's/^[^#]+//'
|
|
||||||
}
|
|
||||||
|
|
||||||
COLOR_FG=$(xcolor foreground)
|
|
||||||
COLOR_BG=$(xcolor background)
|
|
||||||
for ((i=0;i<=15;i++)); do
|
|
||||||
eval "COLOR_$i=\$(xcolor color$i)"
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
# A script run by devmon/udevil when a device is mounted or unmounted, notifying me.
|
|
||||||
|
|
||||||
DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send -a "devmon" "Device change" "$2"
|
|
||||||
ding
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Run resilio (bittorrent sync) from $HOME if it isn't running. Otherwise, open
|
|
||||||
# its gui in the browser.
|
|
||||||
|
|
||||||
if command -v xdg-open >/dev/null; then
|
|
||||||
open=xdg-open
|
|
||||||
elif command -v open >/dev/null; then
|
|
||||||
open=open
|
|
||||||
elif [[ -n $BROWSER ]]; then
|
|
||||||
open=firefox
|
|
||||||
else
|
|
||||||
>&2 echo "No program to open urls with"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! pgrep rslsync >/dev/null; then
|
|
||||||
pushd $HOME >/dev/null
|
|
||||||
rslsync &
|
|
||||||
popd >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -t 0 ]] && $open http://localhost:8888/gui/
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
xdotool search --onlyvisible --classname urxvt-fuzzy windowkill
|
|
||||||
xdotool search --classname urxvt-fuzzy windowmap \
|
|
||||||
|| urxvt -name urxvt-fuzzy -geometry 80x18 -e $SHELL -c sk-apps
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Opens sk-pass in a transient popup window and temporary tmux session,
|
|
||||||
# recreating this window if necessary.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Get firefox's current url; requires "Hostname in title" plugin for firefox
|
|
||||||
win=$(xdotool getactivewindow)
|
|
||||||
if [[ -n $win ]]; then
|
|
||||||
winname=$(xdotool getwindowname $win)
|
|
||||||
if [[ $winname =~ " - Mozilla Firefox$" ]]; then
|
|
||||||
url=${winname% - Mozilla*}
|
|
||||||
url=${url##* - }
|
|
||||||
while (( ${#url//[^.]/} > 1 )); do
|
|
||||||
url=${url#*.}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Present the popup
|
|
||||||
xdotool search --onlyvisible --classname urxvt-fuzzy windowkill
|
|
||||||
bspc monitor -f primary
|
|
||||||
urxvt -name urxvt-fuzzy \
|
|
||||||
-geometry 100x16 \
|
|
||||||
-e $SHELL \
|
|
||||||
-c "sk-pass $@ $url"
|
|
||||||
|
|
||||||
[[ -n $win ]] && xdotool windowactivate $win
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
SCRID=urxvt-scratch
|
|
||||||
focused=$(xdotool getactivewindow)
|
|
||||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
|
||||||
|
|
||||||
if [[ -n $scratch ]]; then
|
|
||||||
if [[ $focused == $scratch ]]; then
|
|
||||||
tmux kill-session -t scratch
|
|
||||||
else
|
|
||||||
xdotool windowactivate $scratch
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
bspc monitor -f primary
|
|
||||||
urxvt -name $SCRID \
|
|
||||||
-geometry 100x26 \
|
|
||||||
-e bash \
|
|
||||||
-c 'tmux new-session -A -s scratch -n scratch'
|
|
||||||
fi
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if (($# == 0)); then
|
|
||||||
data=$(amixer get Master)
|
|
||||||
vol=$(echo "$data" | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)
|
|
||||||
state=$(echo "$data" | grep '\[on\]')
|
|
||||||
[[ -n $state ]] && echo $vol || echo 0
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
[0-9]*) amixer set Master $1 ;;
|
|
||||||
[+-]) amixer set Master 5%$1 ;;
|
|
||||||
*mute) amixer set Master $1 ;;
|
|
||||||
toggle) amixer set Master toggle ;;
|
|
||||||
*) >&2 echo "Invalid command"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# community/xosd
|
|
||||||
if command -v osd_cat >/dev/null; then
|
|
||||||
killall -9 -q osd_cat &>/dev/null
|
|
||||||
osd_cat --font="10x20" --delay=2 --color=white --align=center --pos=bottom --barmode=percentage --percentage $($0) &
|
|
||||||
fi
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
export MONITOR=$(xrandr -q | grep 'primary' | cut -d' ' -f1)
|
|
||||||
|
|
||||||
bspc config -m $MONITOR window_gap 4
|
|
||||||
bspc config -m $MONITOR bottom_padding 158
|
|
||||||
bspc config -m $MONITOR top_padding 0
|
|
||||||
bspc config -m $MONITOR left_padding 0
|
|
||||||
bspc config -m $MONITOR right_padding 0
|
|
|
@ -1,82 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Displays
|
|
||||||
#
|
|
||||||
|
|
||||||
export MONITOR=$(xrandr -q | grep 'primary' | cut -d' ' -f1)
|
|
||||||
export MONITORS=( $(xrandr -q | grep ' connected' | cut -d' ' -f1) )
|
|
||||||
MONITOR=${MONITOR:-${MONITORS[0]}}
|
|
||||||
# Multiple workspaces for main monitor, but only one for others
|
|
||||||
bspc monitor $MONITOR -d {1,2,3,4,5}
|
|
||||||
for mon in ${MONITORS[@]/${MONITOR}}; do
|
|
||||||
bspc monitor $mon -d $mon/1
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! pgrep polybar >/dev/null; then
|
|
||||||
$XDG_CONFIG_HOME/polybar/run.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Aesthetics
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
bspc config split_ratio 0.50
|
|
||||||
bspc config gapless_monocle true
|
|
||||||
bspc config borderless_monocle true
|
|
||||||
bspc config paddingless_monocle true
|
|
||||||
|
|
||||||
bspc config pointer_modifier mod4
|
|
||||||
bspc config pointer_action1 move
|
|
||||||
bspc config pointer_action2 resize_side
|
|
||||||
bspc config pointer_action3 resize_corner
|
|
||||||
|
|
||||||
bspc config remove_disabled_monitors false
|
|
||||||
bspc config remove_unplugged_monitors true
|
|
||||||
|
|
||||||
# bspc config normal_border_color "$COLOR_0"
|
|
||||||
# bspc config active_border_color "$COLOR_0"
|
|
||||||
# bspc config focused_border_color "$COLOR_0"
|
|
||||||
|
|
||||||
bspc config border_width 0
|
|
||||||
bspc config window_gap 8
|
|
||||||
bspc config top_padding 0
|
|
||||||
bspc config bottom_padding 0
|
|
||||||
bspc config left_padding 0
|
|
||||||
bspc config right_padding 0
|
|
||||||
|
|
||||||
bspc config -m $MONITOR window_gap 22
|
|
||||||
bspc config -m $MONITOR bottom_padding 36
|
|
||||||
bspc config -m $MONITOR top_padding 0
|
|
||||||
bspc config -m $MONITOR left_padding 0
|
|
||||||
bspc config -m $MONITOR right_padding 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Rules
|
|
||||||
#
|
|
||||||
|
|
||||||
bspc rule -r '*'
|
|
||||||
|
|
||||||
# Floating fixes
|
|
||||||
bspc rule -a 'Emacs:org*' state=floating
|
|
||||||
bspc rule -a mplayer2 state=floating
|
|
||||||
bspc rule -a mpv state=floating center=on
|
|
||||||
bspc rule -a Vlc state=floating monitor=C center=on
|
|
||||||
bspc rule -a love state=floating center=on sticky=on
|
|
||||||
bspc rule -a SimpleScreenRecorder state=floating center=on sticky=on
|
|
||||||
bspc rule -a Pinentry state=floating center=on
|
|
||||||
|
|
||||||
# Special apps
|
|
||||||
bspc rule -a URxvt:urxvt-scratch state=floating sticky=on center=on monitor=C
|
|
||||||
bspc rule -a URxvt:urxvt-fuzzy state=floating sticky=on center=on monitor=C
|
|
||||||
bspc rule -a Emacs split_ratio=0.25 border=off state=fullscreen
|
|
||||||
bspc rule -a Gimp desktop=^6
|
|
||||||
bspc rule -a feh state=fullscreen
|
|
||||||
bspc rule -a Kupfer.py focus=on
|
|
||||||
bspc rule -a Screenkey manage=off
|
|
||||||
bspc rule -a Chromium monitor=L
|
|
||||||
bspc rule -a Firefox monitor=L
|
|
|
@ -1,122 +0,0 @@
|
||||||
backend = "glx";
|
|
||||||
# backend = "xrender";
|
|
||||||
glx-no-stencil = true;
|
|
||||||
glx-copy-from-front = false;
|
|
||||||
glx-no-rebind-pixmap = true;
|
|
||||||
# glx-swap-method = "undefined";
|
|
||||||
|
|
||||||
# Set VSync method. VSync methods currently available:
|
|
||||||
# + none: No VSync
|
|
||||||
# + drm: VSync with DRM_IOCTL_WAIT_VBLANK. May only work on some drivers.
|
|
||||||
# + opengl: Try to VSync with SGI_video_sync OpenGL extension. Only work on some
|
|
||||||
# drivers.
|
|
||||||
# + opengl-oml: Try to VSync with OML_sync_control OpenGL extension. Only work on some
|
|
||||||
# drivers.
|
|
||||||
# + opengl-swc: Try to VSync with SGI_swap_control OpenGL extension. Only work on some
|
|
||||||
# drivers. Works only with GLX backend. Known to be most effective on many drivers.
|
|
||||||
# Does not actually control paint timing, only buffer swap is affected, so it doesn’t
|
|
||||||
# have the effect of --sw-opti unlike other methods. Experimental.
|
|
||||||
# + opengl-mswc: Try to VSync with MESA_swap_control OpenGL extension. Basically the
|
|
||||||
# same as opengl-swc above, except the extension we use.
|
|
||||||
# (Note some VSync methods may not be enabled at compile time.)
|
|
||||||
vsync = "opengl-mswc";
|
|
||||||
# vsync = "none";
|
|
||||||
|
|
||||||
# Limit compton to repaint at most once every 1 / refresh_rate second to boost
|
|
||||||
# performance. This should not be used with --vsync drm/opengl/opengl-oml as they
|
|
||||||
# essentially does --sw-opti's job already, unless you wish to specify a lower refresh
|
|
||||||
# rate than the actual value.
|
|
||||||
sw-opti = false;
|
|
||||||
|
|
||||||
# Painting on X Composite overlay window. Recommended.
|
|
||||||
paint-on-overlay = true;
|
|
||||||
|
|
||||||
# Enable DBE painting mode, intended to use with VSync to (hopefully) eliminate tearing.
|
|
||||||
# Reported to have no effect, though.
|
|
||||||
dbe = false;
|
|
||||||
|
|
||||||
# Unredirect all windows if a full-screen opaque window is detected, to maximize
|
|
||||||
# performance for full-screen windows, like games. Known to cause flickering when
|
|
||||||
# redirecting/unredirecting windows. paint-on-overlay may make the flickering less
|
|
||||||
# obvious.
|
|
||||||
unredir-if-possible = true;
|
|
||||||
|
|
||||||
# Use WM_TRANSIENT_FOR to group windows, and consider windows in the same group focused
|
|
||||||
# at the same time.
|
|
||||||
detect-transient = false;
|
|
||||||
|
|
||||||
# Use WM_CLIENT_LEADER to group windows, and consider windows in the same group focused
|
|
||||||
# at the same time. WM_TRANSIENT_FOR has higher priority if --detect-transient is
|
|
||||||
# enabled, too.
|
|
||||||
detect-client-leader = false;
|
|
||||||
|
|
||||||
|
|
||||||
########################################
|
|
||||||
#
|
|
||||||
# Shadows
|
|
||||||
#
|
|
||||||
########################################
|
|
||||||
|
|
||||||
shadow = true;
|
|
||||||
no-dock-shadow = true;
|
|
||||||
no-dnd-shadow = true;
|
|
||||||
clear-shadow = true;
|
|
||||||
shadow-radius = 4;
|
|
||||||
shadow-offset-x = -3;
|
|
||||||
shadow-offset-y = 0;
|
|
||||||
shadow-opacity = 0.15;
|
|
||||||
# shadow-red
|
|
||||||
# shadow-green
|
|
||||||
# shadow-blue
|
|
||||||
shadow-exclude = [
|
|
||||||
"n:e:Notification",
|
|
||||||
"class_i = 'Dunst'",
|
|
||||||
"class_i = 'presel_feedback'",
|
|
||||||
"g:e:Conky"
|
|
||||||
];
|
|
||||||
shadow-ignore-shaped = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########################################
|
|
||||||
#
|
|
||||||
# Opacity
|
|
||||||
#
|
|
||||||
########################################
|
|
||||||
|
|
||||||
menu-opacity = 1;
|
|
||||||
active-opacity = 1;
|
|
||||||
inactive-opacity = 1;
|
|
||||||
# frame-opacity = 1.0;
|
|
||||||
inactive-dim = 0.15;
|
|
||||||
inactive-opacity-override = false;
|
|
||||||
opacity-rule = [
|
|
||||||
"80:class_g = 'Bspwm' && class_i = 'presel_feedback'"
|
|
||||||
];
|
|
||||||
alpha-step = 0.06
|
|
||||||
|
|
||||||
# Fading
|
|
||||||
fading = false;
|
|
||||||
fade-delta = 5;
|
|
||||||
fade-in-step = 0.04;
|
|
||||||
fade-out-step = 0.08;
|
|
||||||
# no-fading-openclose = true;
|
|
||||||
|
|
||||||
# Other
|
|
||||||
detect-rounded-corners = true;
|
|
||||||
#mark-wmwin-focused = true;
|
|
||||||
#mark-ovredir-focused = true;
|
|
||||||
refresh-rate = 0;
|
|
||||||
|
|
||||||
focus-exclude = [
|
|
||||||
"class_g = 'love'",
|
|
||||||
"class_g = 'mpv'"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Window type settings
|
|
||||||
wintypes:
|
|
||||||
{
|
|
||||||
tooltip = { fade = true; shadow = false; opacity = 0.85; focus = true; };
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
[global]
|
|
||||||
alignment = left
|
|
||||||
markup = full
|
|
||||||
bounce_freq = 0
|
|
||||||
browser = /usr/bin/firefox -new-tab
|
|
||||||
dmenu = /usr/bin/rofi -dmenu -p dunst:
|
|
||||||
follow = none
|
|
||||||
font = UW Ttyp0 10
|
|
||||||
# font = Misc Tamsyn 12
|
|
||||||
format = "%s\n%b"
|
|
||||||
# geometry [{width}]x{height}][+/-{x}+/-{y}]
|
|
||||||
geometry = "365x15-21+21"
|
|
||||||
history_length = 20
|
|
||||||
horizontal_padding = 16
|
|
||||||
idle_threshold = 120
|
|
||||||
ignore_newline = no
|
|
||||||
indicate_hidden = yes
|
|
||||||
line_height = 0
|
|
||||||
monitor = 0
|
|
||||||
padding = 12
|
|
||||||
separator_color = "#18191b"
|
|
||||||
separator_height = 2
|
|
||||||
show_age_threshold = 60
|
|
||||||
show_indicators = yes
|
|
||||||
shrink = no
|
|
||||||
sort = yes
|
|
||||||
startup_notification = false
|
|
||||||
sticky_history = yes
|
|
||||||
transparency = 1
|
|
||||||
word_wrap = yes
|
|
||||||
max_icon_size = 64
|
|
||||||
# Align icons left/right/off
|
|
||||||
icon_position = right
|
|
||||||
# Paths to default icons.
|
|
||||||
icon_path = /usr/share/icons/hicolor/32x32/apps/:/usr/share/icons/Adwaita/32x32/actions/
|
|
||||||
frame_width = 0
|
|
||||||
frame_color = "#131416"
|
|
||||||
|
|
||||||
[shortcuts]
|
|
||||||
context = ctrl+shift+period
|
|
||||||
|
|
||||||
[urgency_low]
|
|
||||||
# IMPORTANT: colors have to be defined in quotation marks.
|
|
||||||
# Otherwise the "#" and following would be interpreted as a comment.
|
|
||||||
background = "#0a0b0c"
|
|
||||||
foreground = "#b5bd68"
|
|
||||||
timeout = 8
|
|
||||||
|
|
||||||
[urgency_normal]
|
|
||||||
background = "#b5bd68"
|
|
||||||
foreground = "#131416"
|
|
||||||
timeout = 14
|
|
||||||
|
|
||||||
[urgency_critical]
|
|
||||||
background = "#cc6666"
|
|
||||||
foreground = "#131416"
|
|
||||||
timeout = 0
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<match target="pattern">
|
|
||||||
<test name="family" qual="any">
|
|
||||||
<string>monospace</string>
|
|
||||||
</test>
|
|
||||||
<edit binding="strong" mode="prepend" name="family">
|
|
||||||
<string>Fira Mono</string>
|
|
||||||
</edit>
|
|
||||||
</match>
|
|
|
@ -1,11 +0,0 @@
|
||||||
[Filechooser Settings]
|
|
||||||
LocationMode=path-bar
|
|
||||||
ShowHidden=false
|
|
||||||
ShowSizeColumn=true
|
|
||||||
GeometryX=1975
|
|
||||||
GeometryY=450
|
|
||||||
GeometryWidth=1010
|
|
||||||
GeometryHeight=664
|
|
||||||
SortColumn=name
|
|
||||||
SortOrder=ascending
|
|
||||||
StartupMode=recent
|
|
|
@ -1,2 +0,0 @@
|
||||||
# include "/usr/share/themes/Adwaita-Slim-Dark/gtk-2.0/gtkrc"
|
|
||||||
include "/usr/share/themes/Arc-Dark/gtk-2.0/gtkrc"
|
|
|
@ -1,2 +0,0 @@
|
||||||
file:///home/hlissner
|
|
||||||
file:///home/hlissner/work
|
|
|
@ -1,4 +0,0 @@
|
||||||
[Settings]
|
|
||||||
gtk-application-prefer-dark-theme = true
|
|
||||||
gtk-theme-name = Arc-Dark
|
|
||||||
gtk-icon-theme-name = Arc-Dark
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
killall -q polybar
|
|
||||||
while _is_running polybar; do sleep 1; done
|
|
||||||
|
|
||||||
source "${0:A:h}/../../bin/inject-xcolors"
|
|
||||||
pushd ~ >/dev/null
|
|
||||||
polybar main >>$XDG_DATA_HOME/polybar.log 2>&1 &
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
echo "Polybar launched..."
|
|
|
@ -1,35 +0,0 @@
|
||||||
[redshift]
|
|
||||||
temp-day=6500
|
|
||||||
temp-night=3600
|
|
||||||
|
|
||||||
; Enable/Disable a smooth transition between day and night
|
|
||||||
transition=1
|
|
||||||
|
|
||||||
;brightness=0.9
|
|
||||||
;brightness-day=1.0
|
|
||||||
;brightness-night=0.85
|
|
||||||
; screen gamma for all colors...
|
|
||||||
gamma=1.0
|
|
||||||
; or each color channel individually
|
|
||||||
;gamma=0.8:0.7:0.8
|
|
||||||
;gamma-day=0.8:0.7:0.8
|
|
||||||
;gamma-night=0.6
|
|
||||||
|
|
||||||
; redshift -l list
|
|
||||||
location-provider=manual
|
|
||||||
|
|
||||||
; redshift -m list
|
|
||||||
adjustment-method=randr
|
|
||||||
|
|
||||||
; redshift -l PROVIDER:help
|
|
||||||
[manual]
|
|
||||||
;; Horsholm, DK
|
|
||||||
;lat=55.883514
|
|
||||||
;lon=12.504924
|
|
||||||
|
|
||||||
;; Toronto, ON
|
|
||||||
lat=43.7001100
|
|
||||||
lon=-79.4163000
|
|
||||||
|
|
||||||
[randr]
|
|
||||||
;screen=0
|
|
|
@ -1,147 +0,0 @@
|
||||||
#
|
|
||||||
# wm independent hotkeys
|
|
||||||
#
|
|
||||||
|
|
||||||
# terminal emulator
|
|
||||||
mod4 + ctrl + Return
|
|
||||||
urxvt
|
|
||||||
mod4 + ctrl + shift + Return
|
|
||||||
urxvt -name urxvt-stream
|
|
||||||
mod4 + grave
|
|
||||||
urxvt-scratch-window
|
|
||||||
mod4 + ctrl + grave
|
|
||||||
emacsclient -e nil && bspc rule -a 'Emacs' -o state=floating && emacs-anywhere
|
|
||||||
mod4 + ctrl + shift + grave
|
|
||||||
bspc rule -a 'Emacs' -o state=floating && org-capture
|
|
||||||
mod4 + space
|
|
||||||
urxvt-app-launcher
|
|
||||||
mod4 + backslash
|
|
||||||
urxvt-pass-manager
|
|
||||||
mod4 + mod1 + backslash
|
|
||||||
firefox-current
|
|
||||||
# urxvt-pass-manager -r
|
|
||||||
|
|
||||||
# reload sxhkd
|
|
||||||
mod4 + ctrl + shift + Escape
|
|
||||||
ding; pkill -USR1 -x sxhkd
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Media keys
|
|
||||||
#
|
|
||||||
|
|
||||||
Print
|
|
||||||
ssclip
|
|
||||||
mod4 + Print
|
|
||||||
maim ~/screenshots/$(date +%F-%T).png && notify-send "Fullscreen screenshot saved"
|
|
||||||
mod4 + shift + Print
|
|
||||||
rec -s ~/screenshots/$(date +%F-%T).mp4
|
|
||||||
|
|
||||||
Pause
|
|
||||||
mpc -q toggle # play/pause music
|
|
||||||
mod4 + {Pause,XF86Eject}
|
|
||||||
zzz # sleep display
|
|
||||||
mod4 + shift + Pause
|
|
||||||
zzz -f # sleep computer
|
|
||||||
Scroll_Lock
|
|
||||||
vol toggle
|
|
||||||
|
|
||||||
# Media Keys
|
|
||||||
XF86Audio{Play,Pause}
|
|
||||||
mpc -q toggle
|
|
||||||
XF86Audio{Prev,Next}
|
|
||||||
mpc -q {prev,next}
|
|
||||||
XF86Audio{LowerVolume,RaiseVolume}
|
|
||||||
vol {-,+}
|
|
||||||
XF86AudioMute
|
|
||||||
vol toggle
|
|
||||||
|
|
||||||
mod4 + {Down,Up}
|
|
||||||
vol {-,+}
|
|
||||||
mod4 + {Left,Right}
|
|
||||||
mpc {prev,next}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# bspwm hotkeys
|
|
||||||
#
|
|
||||||
|
|
||||||
# quit bspwm normally
|
|
||||||
mod4 + alt + Escape
|
|
||||||
bspc quit
|
|
||||||
|
|
||||||
# close and kill
|
|
||||||
mod4 + {_,shift + }q
|
|
||||||
bspc node -{c,k}
|
|
||||||
|
|
||||||
#
|
|
||||||
# state/flags
|
|
||||||
#
|
|
||||||
|
|
||||||
mod4 + {ctrl,shift + } f
|
|
||||||
{bspc desktop -l next,bspc node -t \~floating}
|
|
||||||
|
|
||||||
mod4 + shift + p
|
|
||||||
bspc node -t \~pseudo_tiled
|
|
||||||
|
|
||||||
# set the node flags
|
|
||||||
mod4 + ctrl + {x,y,z}
|
|
||||||
bspc node -g {locked,sticky,private}
|
|
||||||
|
|
||||||
#
|
|
||||||
# focus/swap
|
|
||||||
#
|
|
||||||
|
|
||||||
# focus/swap the node in the given direction
|
|
||||||
mod4 + {_,ctrl +}{h,j,k,l}
|
|
||||||
bspc-focus {_,-m }{west,south,north,east}
|
|
||||||
|
|
||||||
mod4 + shift + {_,ctrl +}{h,j,k,l}
|
|
||||||
bspc-swap {_,-m }{west,south,north,east}
|
|
||||||
|
|
||||||
# focus the node for the given path jump
|
|
||||||
mod4 + {p,comma,period}
|
|
||||||
bspc node -f @{parent,first,second}
|
|
||||||
|
|
||||||
# focus monitor or send to the given desktop
|
|
||||||
mod4 + bracket{left,right}
|
|
||||||
bspc desktop -f focused#{prev,next}.local
|
|
||||||
|
|
||||||
mod4 + ctrl + {_,shift +}{1-9,0}
|
|
||||||
bspc {desktop -f,node -d} {1-9,10}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# preselect
|
|
||||||
#
|
|
||||||
|
|
||||||
# preselect the direction
|
|
||||||
mod4 + mod1 + ctrl + {h,j,k,l}
|
|
||||||
bspc node -p {west,south,north,east}
|
|
||||||
|
|
||||||
# preselect the ratio
|
|
||||||
mod4 + mod1 + ctrl + {1-9}
|
|
||||||
bspc node -o 0.{1-9}5
|
|
||||||
|
|
||||||
# cancel the preselection for the focused node
|
|
||||||
mod4 + mod1 + ctrl + space
|
|
||||||
bspc node -p cancel
|
|
||||||
|
|
||||||
# cancel the preselection for the focused desktop
|
|
||||||
#mod4 + alt + shift + space
|
|
||||||
# bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
|
|
||||||
|
|
||||||
# expand the tiled space in the given direction
|
|
||||||
#mod4 + alt + {h,j,k,l}
|
|
||||||
# bspc node {@west -r -,@south -r +,@north -r -,@east -r +}64
|
|
||||||
#
|
|
||||||
## contract the tiled space in the given direction
|
|
||||||
#mod4 + alt + ctrl + {h,j,k,l}
|
|
||||||
# bspc node {@east -r -,@north -r +,@south -r -,@west -r +}64
|
|
||||||
|
|
||||||
# move a floating window
|
|
||||||
#mod4 + alt + {Left,Down,Up,Right}
|
|
||||||
# xdo move {-x -,-y +,-y -,-x +}40
|
|
||||||
|
|
||||||
#mod4 + alt + ctrl + {Left,Down,Up,Right}
|
|
||||||
# xdo resize {-w -,-h -,-h -,-w -}40
|
|
|
@ -1,17 +0,0 @@
|
||||||
# field allowed values
|
|
||||||
# ----- --------------
|
|
||||||
# minute 0-59
|
|
||||||
# hour 0-23
|
|
||||||
# day of month 1-31
|
|
||||||
# month 1-12 (or names, see below)
|
|
||||||
# day of week 0-7 (0 or 7 is Sun, or use names)
|
|
||||||
#------------------------------------------------------------
|
|
||||||
# m hr d m w cmd
|
|
||||||
# 0 * * * * ...
|
|
||||||
|
|
||||||
# Polybar
|
|
||||||
0 * * * * polybar-msg hook pkg 1
|
|
||||||
*/5 * * * * polybar-msg hook mail 1
|
|
||||||
|
|
||||||
# Personal
|
|
||||||
0 * * * * DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "It is $(date +\%H:\%M)"
|
|
|
@ -1,16 +0,0 @@
|
||||||
export BROWSER=firefox
|
|
||||||
export GNUPGHOME="$XDG_CONFIG_HOME/gpg"
|
|
||||||
export GTK2_RC_FILES="${0:A:h}/config/gtk-2.0/gtkrc"
|
|
||||||
export URXVT_PERL_LIB="$XDG_CONFIG_HOME/urxvt"
|
|
||||||
export QT_QPA_PLATFORMTHEME=gtk2
|
|
||||||
|
|
||||||
_source "$XDG_RUNTIME_DIR/ssh-agent-env" >/dev/null
|
|
||||||
if [[ -z $SSH_AGENT_PID ]] || ! ps $SSH_AGENT_PID >/dev/null; then
|
|
||||||
ssh-agent -s >"$XDG_RUNTIME_DIR/ssh-agent-env"
|
|
||||||
_source "$XDG_RUNTIME_DIR/ssh-agent-env" >/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
_is_running gpg-agent || {
|
|
||||||
gpg-agent --pinentry-program /usr/bin/pinentry-gtk-2 --daemon >"$XDG_RUNTIME_DIR/gpg-agent-env"
|
|
||||||
}
|
|
||||||
_source "$XDG_RUNTIME_DIR/gpg-agent-env" >/dev/null
|
|
|
@ -1,11 +0,0 @@
|
||||||
[Trigger]
|
|
||||||
Operation = Install
|
|
||||||
Operation = Upgrade
|
|
||||||
Operation = Remove
|
|
||||||
Type = Package
|
|
||||||
Target = nvidia
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Depends = mkinitcpio
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/bin/mkinitcpio -p linux
|
|
|
@ -1,10 +0,0 @@
|
||||||
[Trigger]
|
|
||||||
Operation = Upgrade
|
|
||||||
Type = Package
|
|
||||||
Target = *
|
|
||||||
|
|
||||||
[Action]
|
|
||||||
Description = "Updating polybar"
|
|
||||||
When = PostTransaction
|
|
||||||
Exec = /usr/bin/polybar-msg hook pkg 1
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
2
|
|
||||||
kakwafont-12-b.pcf.gz -kakwa-kakwafont-medium-r-bold--12-120-72-72-c-60-iso8859-1
|
|
||||||
kakwafont-12-n.pcf.gz -kakwa-kakwafont-medium-r-normal--12-120-72-72-c-60-iso8859-1
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if command -v aseprite >/dev/null; then
|
|
||||||
echo "Aseprite is already installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -e
|
|
||||||
yay --needed --noconfirm -S ninja cmake libxcursor
|
|
||||||
rm -rf /tmp/aseprite
|
|
||||||
if git clone --recursive https://github.com/aseprite/aseprite /tmp/aseprite; then
|
|
||||||
mkdir /tmp/aseprite/build && cd /tmp/aseprite/build
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja ..
|
|
||||||
ninja aseprite
|
|
||||||
ninja install
|
|
||||||
fi
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if ! grep -e '^[multilib]' /etc/pacman.conf >/dev/null; then
|
|
||||||
echo "[multilib]\nInclude = /etc/pacman.d/mirrorlist" | \
|
|
||||||
sudo tee -a /etc/pacman.conf
|
|
||||||
sudo pacman -Sy
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo pacman --needed -S steam
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
sudo pacman --noconfirm --needed -S udevil devmon
|
|
||||||
sudo systemctl enable devmon@$USER
|
|
||||||
sudo systemctl start devmon@$USER
|
|
||||||
|
|
||||||
ARCH=$(cd "${0:A:h}/.." && pwd)
|
|
||||||
sudo sed -i "s@^# \(success_exec =\)@\1 $ARCH/bin/notify-mount@" /etc/udevil/udevil.conf
|
|
|
@ -1,43 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
DOTS=~/.dotfiles
|
|
||||||
source $DOTS/env
|
|
||||||
|
|
||||||
# A tidy $HOME is a tidy mind
|
|
||||||
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
|
|
||||||
[[ -e ~/.Xauthority ]] && mv -f ~/.Xauthority "$XAUTHORITY"
|
|
||||||
|
|
||||||
#
|
|
||||||
ARCH=$DOTS/base/arch-desktop
|
|
||||||
[[ -f $ARCH/Xresources ]] && xrdb $ARCH/Xresources
|
|
||||||
[[ -f $ARCH/Xmodmap ]] && xmodmap $ARCH/Xmodmap
|
|
||||||
|
|
||||||
# set wallpaper
|
|
||||||
[[ -e ~/wallpaper ]] && feh --no-fehbg --image-bg black --bg-center ~/wallpaper
|
|
||||||
|
|
||||||
# Let me know
|
|
||||||
$DOTS/bin/ding startup
|
|
||||||
|
|
||||||
# autostart programs
|
|
||||||
{
|
|
||||||
run() {
|
|
||||||
if _is_callable "$1" && ! _is_running "$1"; then
|
|
||||||
"$@"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# essentials
|
|
||||||
run sxhkd & # keyboard daemon
|
|
||||||
run dunst & # notifications
|
|
||||||
|
|
||||||
# non-essentials
|
|
||||||
{
|
|
||||||
sleep 2
|
|
||||||
run mpd & # music server
|
|
||||||
run redshift & # screen temperature based on time-of-day
|
|
||||||
run rslsync & # resilio sync
|
|
||||||
run compton & # perdy effects + transparency
|
|
||||||
|
|
||||||
# If sxhkd isn't running by now, something is wrong
|
|
||||||
_is_running sxhkd || urxvt &
|
|
||||||
} &
|
|
||||||
} 2>&1 >$XDG_DATA_HOME/xsession-errors.log
|
|
|
@ -1,43 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
source ${0:A:h}/../../deploy
|
|
||||||
|
|
||||||
install() {
|
|
||||||
if ! nc -z 8.8.8.8 53 >/dev/null 2>&1; then
|
|
||||||
>&2 echo "No internet connection"
|
|
||||||
return 1
|
|
||||||
elif ! sudo pacman -Syu --noconfirm; then
|
|
||||||
>&2 echo "Could not update pacman"
|
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Core essentials
|
|
||||||
sudo pacman --needed --noconfirm -S wget git curl tree rsync dnsutils
|
|
||||||
|
|
||||||
# Set up yay (AUR helper)
|
|
||||||
if ! _is_callable yay; then
|
|
||||||
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
|
||||||
pushd /tmp/yay
|
|
||||||
makepkg -si
|
|
||||||
popd
|
|
||||||
rm -rf /tmp/yay
|
|
||||||
|
|
||||||
if ! _is_callable yay; then
|
|
||||||
>&2 echo "Yay was not successfully installed"
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
yay --needed --noconfirm -S ripgrep the_silver_searcher bc cronie
|
|
||||||
sudo systemctl enable cronie
|
|
||||||
}
|
|
||||||
|
|
||||||
update() {
|
|
||||||
_is_callable yay && local pac=yay
|
|
||||||
${pac:-sudo pacman} -Syu --noconfirm
|
|
||||||
}
|
|
||||||
|
|
||||||
# link() {}
|
|
||||||
|
|
||||||
# clean() {}
|
|
||||||
|
|
||||||
init "$@"
|
|
|
@ -1,22 +0,0 @@
|
||||||
alias ls="${aliases[ls]:-ls} --color=auto --group-directories-first"
|
|
||||||
|
|
||||||
alias kb=keybase
|
|
||||||
alias sc=systemctl
|
|
||||||
alias jc=journalctl
|
|
||||||
alias ssc='sudo systemctl'
|
|
||||||
alias ufw='sudo ufw'
|
|
||||||
|
|
||||||
alias yayc='yay -Sc' # clean pacman
|
|
||||||
alias yayo='yay -Qtdq' # orphaned packages
|
|
||||||
|
|
||||||
alias reboot='sudo systemctl reboot'
|
|
||||||
alias shutdown='sudo systemctl poweroff'
|
|
||||||
|
|
||||||
# Clipboard pipes
|
|
||||||
if _is_callable xclip; then
|
|
||||||
alias y='xclip -selection clipboard -in'
|
|
||||||
alias p='xclip -selection clipboard -out'
|
|
||||||
elif _is_callable xsel; then
|
|
||||||
alias y='xsel -i --clipboard'
|
|
||||||
alias p='xsel -o --clipboard'
|
|
||||||
fi
|
|
|
@ -1,2 +0,0 @@
|
||||||
export GNUPGHOME="$XDG_CONFIG_HOME/gpg"
|
|
||||||
export TERMINFO="$XDG_CONFIG_HOME/terminfo"
|
|
|
@ -1,70 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# This script bootstraps arch linux with the utmost essentials. It expects an internet
|
|
||||||
# connection, and the harddrives to be set up (and one of the mounted to /mnt).
|
|
||||||
|
|
||||||
MOUNT=/mnt
|
|
||||||
|
|
||||||
exists() { command -v "$1" >/dev/null; }
|
|
||||||
arch() { arch-chroot "$MOUNT" /bin/bash -c "$1"; }
|
|
||||||
pac() { pacstrap "$MOUNT" $@; }
|
|
||||||
|
|
||||||
if ! exists arch-chroot; then
|
|
||||||
>&2 echo "Meant to be run from the Arch Linux installer"
|
|
||||||
exit 1
|
|
||||||
elif ! grep "$MOUNT " /proc/mounts >/dev/null; then
|
|
||||||
>&2 echo "$MOUNT isn't mounted"
|
|
||||||
exit 2
|
|
||||||
elif ! ping -c1 http://google.com >/dev/null; then
|
|
||||||
>&2 echo "No internet connection detected!"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
## Collect info
|
|
||||||
# hostname
|
|
||||||
read -rp "Hostname:\t" host
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "$host" > "$MOUNT/etc/hostname"
|
|
||||||
|
|
||||||
# ensure keys are up to date
|
|
||||||
pacman-key --refresh-keys
|
|
||||||
pacman -Syy
|
|
||||||
|
|
||||||
# bootstrap
|
|
||||||
pac base base-devel intel-ucode
|
|
||||||
# device mounting drivers
|
|
||||||
pac dosfstools ntfs-3g exfat-utils hfsprogs
|
|
||||||
|
|
||||||
# networking support
|
|
||||||
WIRELESS_DEV=$(ip link | grep wlp | awk '{print $2}'| sed 's/://' | sed '1!d')
|
|
||||||
if [[ -n $WIRELESS_DEV ]]; then
|
|
||||||
echo "==> ${WIRELESS_DEV} interface detected"
|
|
||||||
pac iw wireless_tools wpa_actiond wpa_supplicant dialog netctl
|
|
||||||
fi
|
|
||||||
|
|
||||||
WIRED_DEV=$(ip link | grep "en[sop]" | awk '{print $2}'| sed 's/://' | sed '1!d')
|
|
||||||
if [[ -n $WIRED_DEV ]]; then
|
|
||||||
echo "==> ${WIRED_DEV} interface detected"
|
|
||||||
arch "systemctl enable dhcpcd@${WIRED_DEV}.service"
|
|
||||||
fi
|
|
||||||
# Speed up connections on boot
|
|
||||||
if ! grep "^noarp$" $MOUNT/etc/dhcpcd.conf; then
|
|
||||||
echo -e "\nnoarp" >> $MOUNT/etc/dhcpcd.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
# locale
|
|
||||||
sed -i '/^#en_US\.UTF-8/s/^#//' $MOUNT/etc/locale.gen
|
|
||||||
arch "locale-gen"
|
|
||||||
# datetime
|
|
||||||
pac ntp
|
|
||||||
arch "systemctl enable ntpd.service"
|
|
||||||
arch "ln -sfv /usr/share/zoneinfo/America/Toronto /etc/localtime"
|
|
||||||
|
|
||||||
# finalization
|
|
||||||
genfstab -U "$MOUNT" >> "$MOUNT/etc/fstab"
|
|
||||||
arch "bootctl --path=/boot install"
|
|
||||||
arch "mkinitcpio -p linux"
|
|
|
@ -1,35 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
source ${0:A:h}/../../deploy
|
|
||||||
|
|
||||||
install() {
|
|
||||||
# Install homebrew
|
|
||||||
if ! _is_callable brew; then
|
|
||||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
brew install \
|
|
||||||
wget curl tree coreutils bash gnupg2 \
|
|
||||||
the_silver_searcher ripgrep ffmpeg keybase \
|
|
||||||
neofetch youtube-dl pinentry-mac
|
|
||||||
|
|
||||||
# pass-otp
|
|
||||||
brew install pass oath-toolkit
|
|
||||||
if _ensure_repo tadfisher/pass-otp /tmp/pass-otp; then
|
|
||||||
cd /tmp/pass-otp
|
|
||||||
make install PREFIX=/usr/local
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
update() {
|
|
||||||
if _is_callable brew; then
|
|
||||||
brew update && brew upgrade && brew cleanup
|
|
||||||
else
|
|
||||||
echo-fail "homebrew not detected"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# link() {}
|
|
||||||
|
|
||||||
# clean() {}
|
|
||||||
|
|
||||||
init "$@"
|
|
|
@ -1,14 +0,0 @@
|
||||||
alias ls="gls --color=auto --group-directories-first"
|
|
||||||
alias date=gdate
|
|
||||||
|
|
||||||
alias y=pbcopy
|
|
||||||
alias p=pbpaste
|
|
||||||
|
|
||||||
alias br=brew
|
|
||||||
alias bru='brew update && brew upgrade && brew cleanup'
|
|
||||||
alias brc='brew cask'
|
|
||||||
|
|
||||||
# OS X has no `md5sum`, so use `md5` as a fallback
|
|
||||||
_is_callable md5sum || alias md5sum="md5"
|
|
||||||
# OS X has no `sha1sum`, so use `shasum` as a fallback
|
|
||||||
_is_callable sha1sum || alias sha1sum="shasum"
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Start taking screenshots every N seconds, until this script is
|
|
||||||
# called again.
|
|
||||||
|
|
||||||
if [ ! -f ~/.ss ]; then
|
|
||||||
dir="$1"
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
[ ! -d ~/Desktop/ss ] && mkdir -p ~/Desktop/ss
|
|
||||||
dir=~/Desktop/ss
|
|
||||||
fi
|
|
||||||
echo "$dir" > ~/.ss
|
|
||||||
echo "Timelapse, go!"
|
|
||||||
i=1;while [ -f ~/.ss ];do screencapture -t jpg -x "$dir/$i.jpg"; let i++;sleep 5; done &
|
|
||||||
else
|
|
||||||
echo "Deactivating timelapse! Images in: $(cat ~/.ss)/"
|
|
||||||
rm ~/.ss
|
|
||||||
fi
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ffmpeg -r 24 -i %d.jpg -b 16000k $1
|
|
|
@ -1,18 +0,0 @@
|
||||||
export GNUPGHOME="$XDG_CONFIG_HOME/gpg"
|
|
||||||
export BROWSER='open'
|
|
||||||
|
|
||||||
# export CC=/usr/bin/clang
|
|
||||||
# export CXX=/usr/bin/clang++
|
|
||||||
# export CXXFLAGS="-I/usr/local/include"
|
|
||||||
export C_INCLUDE_PATH="/usr/local/include"
|
|
||||||
export CPLUS_INCLUDE_PATH="/usr/local/include"
|
|
||||||
export LIBRARY_PATH="/usr/local/lib"
|
|
||||||
# export LDFLAGS="-L/usr/local/lib"
|
|
||||||
|
|
||||||
export LESS='-g -i -M -R -S -w -z-4'
|
|
||||||
if _is_callable lesspipe; then
|
|
||||||
export LESSOPEN='| /usr/bin/env lesspipe %s 2>&-'
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
path=( /usr/local/{s,}bin $path )
|
|
9
bin/autoclicker
Executable file
9
bin/autoclicker
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p xdotool
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
xdotool mousedown 1
|
||||||
|
sleep 0.01
|
||||||
|
xdotool mouseup 1
|
||||||
|
sleep 0.01
|
||||||
|
done
|
29
bin/clip
29
bin/clip
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# An OS-agnostic wrapper around the system clipboard (well, for MacOS and
|
|
||||||
# Linux).
|
|
||||||
|
|
||||||
if [[ -t 0 ]]; then
|
|
||||||
if command -v xclip >/dev/null; then
|
|
||||||
xclip -display :0 -selection clipboard -out
|
|
||||||
elif command -v xsel >/dev/null; then
|
|
||||||
xsel --clipboard --output
|
|
||||||
elif command -v pbpaste >/dev/null; then
|
|
||||||
pbpaste
|
|
||||||
else
|
|
||||||
>&2 echo "No clipboard detected. Aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if command -v xclip >/dev/null; then
|
|
||||||
xclip -display :0 -selection clipboard -in
|
|
||||||
elif command -v xsel >/dev/null; then
|
|
||||||
xsel --clipboard --input
|
|
||||||
elif command -v pbcopy >/dev/null; then
|
|
||||||
pbcopy
|
|
||||||
else
|
|
||||||
>&2 echo "No clipboard detected. Aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
23
bin/colors
23
bin/colors
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Prints a bunch of color codes to the terminal to demonstrate what's available.
|
|
||||||
# Each line is the color code of one forground color, out of 17 (default + 16
|
|
||||||
# escapes), followed by a test use of that color on all nine background colors
|
|
||||||
# (default + 8 escapes).
|
|
||||||
|
|
||||||
T=niX # The test text
|
|
||||||
|
|
||||||
echo -e "\n 40m 41m 42m 43m\
|
|
||||||
44m 45m 46m 47m";
|
|
||||||
|
|
||||||
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
|
|
||||||
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
|
|
||||||
' 36m' '1;36m' ' 37m' '1;37m';
|
|
||||||
do FG=${FGs// /}
|
|
||||||
echo -en " $FGs \033[$FG $T "
|
|
||||||
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
|
|
||||||
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
|
|
||||||
done
|
|
||||||
echo;
|
|
||||||
done
|
|
||||||
echo
|
|
6
bin/ding
6
bin/ding
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
DEFAULT="$DOTFILES_ASSETS/sounds/${1:-ding}.ogg"
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*) afplay $DEFAULT ;;
|
|
||||||
linux*) paplay $DEFAULT ;;
|
|
||||||
esac &
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# NOTE make sure your .curlrc doesn't set a real useragent
|
|
||||||
curl http://wttr.in/${1:-toronto}
|
|
40
bin/gpgzip
40
bin/gpgzip
|
@ -1,40 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Encrypt/decrypt and compress folders with gpg+tar.
|
|
||||||
# Usage:
|
|
||||||
# clump foldername # packs
|
|
||||||
# clump foldername.clump # unpacks
|
|
||||||
|
|
||||||
set -e
|
|
||||||
if (($# == 0)); then
|
|
||||||
>&2 echo "Usage: $0 <FILE|DIRECTORY> [DEST]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ext='clump'
|
|
||||||
target="$1"
|
|
||||||
cmd=
|
|
||||||
if [[ -f $target ]]; then
|
|
||||||
cmd=unpack
|
|
||||||
elif [[ -d $target ]]; then
|
|
||||||
cmd=pack
|
|
||||||
else
|
|
||||||
>&2 echo "Not a valid target: '$target'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $cmd in
|
|
||||||
p|pack)
|
|
||||||
if [[ -f $target.$ext ]]; then
|
|
||||||
>&2 echo "Destination file already exists"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
tar -pcvf - "$target" | gpg -c > "$target.$ext"
|
|
||||||
echo "Packed into $target.$ext"
|
|
||||||
;;
|
|
||||||
u|unpack)
|
|
||||||
tmpfile=$(mktemp)
|
|
||||||
gpg -d "$target" > "$tmpfile" && tar -pxvf "$tmpfile"
|
|
||||||
rm -f "$tmpfile"
|
|
||||||
;;
|
|
||||||
esac
|
|
36
bin/htmlent
36
bin/htmlent
|
@ -1,36 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
"""
|
|
||||||
Encode/decode HTML entities in stdin or given file(s).
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import fileinput
|
|
||||||
import html
|
|
||||||
from html.entities import entitydefs
|
|
||||||
|
|
||||||
ENTITIES = {value: key for key, value in entitydefs.items()}
|
|
||||||
|
|
||||||
|
|
||||||
def encode(text):
|
|
||||||
t = ""
|
|
||||||
for c in text:
|
|
||||||
if c in ENTITIES:
|
|
||||||
t += "&" + ENTITIES[c] + ";"
|
|
||||||
else:
|
|
||||||
t += c
|
|
||||||
return t
|
|
||||||
|
|
||||||
def decode(text):
|
|
||||||
return html.unescape(text)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
opts = argparse.ArgumentParser(description="Encodes (or decodes) HTML entities in text.")
|
|
||||||
opts.add_argument('file', type=str, nargs="*", help="File to encode/decode")
|
|
||||||
opts.add_argument('-d', '--decode', action='store_true', help="Decode the given files/input")
|
|
||||||
args = opts.parse_args()
|
|
||||||
|
|
||||||
text = [line for line in fileinput.input(args.file)]
|
|
||||||
action = decode if args.decode else encode
|
|
||||||
print(action("\n".join(text).strip()))
|
|
50
bin/ix.io
50
bin/ix.io
|
@ -1,50 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
# Sends file(s) or stdin to a ix.io
|
|
||||||
set -e
|
|
||||||
|
|
||||||
_usage() {
|
|
||||||
more <<EOL
|
|
||||||
Usage: ${0:A:t} [FILE...]
|
|
||||||
|
|
||||||
Uploads text files/stdin to ix.io.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-l LANG Specify file extension for syntax highlight
|
|
||||||
-h This information
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
${0##*/} script.py
|
|
||||||
${0##*/} -l py sometext
|
|
||||||
echo "Hello world" | ${0:A:t}
|
|
||||||
echo "puts 'Hi'" | ${0:A:t} -l rb
|
|
||||||
EOL
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
while getopts hl: opt; do
|
|
||||||
case $opt in
|
|
||||||
l) lang="?$OPTARG"
|
|
||||||
;;
|
|
||||||
[h?]) _usage; exit; ;;
|
|
||||||
:) >&2 echo "$OPTARG requires an argument"
|
|
||||||
_usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
shift $((OPTIND-1))
|
|
||||||
|
|
||||||
if (($# == 0)) && [[ -t 0 ]]; then
|
|
||||||
>&2 echo "Nothing in stdin and no files specified!"
|
|
||||||
>&2 _usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
url=$(cat "$@" | curl -s -F 'f:1=<-' ix.io)
|
|
||||||
|
|
||||||
# Naive lang detection from file extension
|
|
||||||
[[ $1 == *.* && -z $lang ]] && lang="${1##*.}"
|
|
||||||
# Show url
|
|
||||||
url=$(printf "%s/%s" "$url" "$lang")
|
|
||||||
echo $url | clip
|
|
||||||
echo $url
|
|
18
bin/lesspipe
18
bin/lesspipe
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Read a file with possible syntax coloring applied
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
*.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|\
|
|
||||||
*.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\
|
|
||||||
*.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\
|
|
||||||
*.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass)
|
|
||||||
pygmentize -f 256 "$1" ;;
|
|
||||||
.bashrc|.bash_aliases|.bash_environment)
|
|
||||||
pygmentize -f 256 -l sh "$1" ;;
|
|
||||||
*)
|
|
||||||
if ! grep "#\!/.+[/ ](ba|z)?sh" "$1" >/dev/null; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
pygmentize -f 256 -l sh "$1"
|
|
||||||
esac
|
|
|
@ -1,51 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Lists the contents of archives.
|
|
||||||
#
|
|
||||||
# Adapted from a script by Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
||||||
|
|
||||||
if (($# == 0)); then
|
|
||||||
cat >&2 <<EOF
|
|
||||||
usage: $0 [-option] [file ...]
|
|
||||||
|
|
||||||
options:
|
|
||||||
-v, --verbose verbose archive listing
|
|
||||||
|
|
||||||
Report bugs to <sorin.ionescu@gmail.com>.
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $1 == -v || $1 == --verbose ]]; then
|
|
||||||
verbose=0
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
while (($# > 0)); do
|
|
||||||
if [[ ! -s $1 ]]; then
|
|
||||||
>&2 echo "$0: file not valid: $1"
|
|
||||||
shift
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
case ${1:l} in
|
|
||||||
*.tar.gz|*.tgz) tar t${verbose:+v}vzf "$1" ;;
|
|
||||||
*.tar.bz2|*.tbz|*.tbz2) tar t${verbose:+v}jf "$1" ;;
|
|
||||||
*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
|
||||||
&& tar --xz -t${verbose:+v}f "$1" \
|
|
||||||
|| xzcat "$1" | tar t${verbose:+v}f - ;;
|
|
||||||
*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
|
||||||
&& tar --lzma -t${verbose:+v}f "$1" \
|
|
||||||
|| lzcat "$1" | tar x${verbose:+v}f - ;;
|
|
||||||
*.tar) tar t${verbose:+v}f "$1" ;;
|
|
||||||
*.zip) unzip -l${verbose:+v} "$1" ;;
|
|
||||||
*.rar) unrar &> /dev/null \
|
|
||||||
&& unrar ${${verbose:+v}:-l} "$1" \
|
|
||||||
|| rar ${${verbose:+v}:-l} "$1" ;;
|
|
||||||
*.7z) 7za l "$1" ;;
|
|
||||||
*) >&2 echo "$0: cannot list: $1"
|
|
||||||
success=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
shift
|
|
||||||
done
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p ffmpeg gifsicle
|
||||||
|
|
||||||
# Uses ffmpeg to convert a video file to a gif file. Optimizes the final result
|
# Uses ffmpeg to convert a video file to a gif file. Optimizes the final result
|
||||||
# with gifsicle.
|
# with gifsicle.
|
||||||
|
@ -69,6 +70,4 @@ flags="fps=${fps}$scale"
|
||||||
ffmpeg -v warning $start $duration -i "$src" -vf "$flags,palettegen=stats_mode=full" -y "$PALETTE"
|
ffmpeg -v warning $start $duration -i "$src" -vf "$flags,palettegen=stats_mode=full" -y "$PALETTE"
|
||||||
ffmpeg -v warning $start $duration -i "$src" -i "$PALETTE" -lavfi "$flags [x]; [x][1:v] paletteuse" -y "$dest"
|
ffmpeg -v warning $start $duration -i "$src" -i "$PALETTE" -lavfi "$flags [x]; [x][1:v] paletteuse" -y "$dest"
|
||||||
|
|
||||||
if command -v gifsicle >/dev/null; then
|
|
||||||
gifsicle -O3 "$dest" -o "$dest"
|
gifsicle -O3 "$dest" -o "$dest"
|
||||||
fi
|
|
||||||
|
|
12
bin/open
12
bin/open
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*) /usr/bin/open "$@" ;;
|
|
||||||
linux*) xdg-open "$@" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# OPTIONAL: requires shell/tmux
|
|
||||||
if command -v 'tmux-session-name' >/dev/null; then
|
|
||||||
# If this was used from a scratch tmux terminal, close it
|
|
||||||
[[ "$(tmux-session-name)" == scratch ]] && tmux kill-session -t scratch
|
|
||||||
fi
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# ANSI color scheme script featuring PACMAN
|
|
||||||
# by pfh
|
|
||||||
#
|
|
||||||
# Initializing procedure by lolilolicon
|
|
||||||
|
|
||||||
f=3 b=4
|
|
||||||
for j in f b; do
|
|
||||||
for i in {0..7}; do
|
|
||||||
printf -v $j$i %b "\e[${!j}${i}m"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
bld=$'\e[1m'
|
|
||||||
rst=$'\e[0m'
|
|
||||||
inv=$'\e[7m'
|
|
||||||
|
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
$rst
|
|
||||||
$f3 ▄███████▄ $f1 ▄██████▄ $f2 ▄██████▄ $f4 ▄██████▄ $f5 ▄██████▄ $f6 ▄██████▄
|
|
||||||
$f3▄█████████▀▀ $f1▄$f7█▀█$f1██$f7█▀█$f1██▄ $f2▄█$f7███$f2██$f7███$f2█▄ $f4▄█$f7███$f4██$f7███$f4█▄ $f5▄█$f7███$f5██$f7███$f5█▄ $f6▄██$f7█▀█$f6██$f7█▀█$f6▄
|
|
||||||
$f3███████▀ $f7▄▄ ▄▄ ▄▄ $f1█$f7▄▄█$f1██$f7▄▄█$f1███ $f2██$f7█ █$f2██$f7█ █$f2██ $f4██$f7█ █$f4██$f7█ █$f4██ $f5██$f7█ █$f5██$f7█ █$f5██ $f6███$f7█▄▄$f6██$f7█▄▄$f6█
|
|
||||||
$f3███████▄ $f7▀▀ ▀▀ ▀▀ $f1████████████ $f2████████████ $f4████████████ $f5████████████ $f6████████████
|
|
||||||
$f3▀█████████▄▄ $f1██▀██▀▀██▀██ $f2██▀██▀▀██▀██ $f4██▀██▀▀██▀██ $f5██▀██▀▀██▀██ $f6██▀██▀▀██▀██
|
|
||||||
$f3 ▀███████▀ $f1▀ ▀ ▀ ▀ $f2▀ ▀ ▀ ▀ $f4▀ ▀ ▀ ▀ $f5▀ ▀ ▀ ▀ $f6▀ ▀ ▀ ▀
|
|
||||||
$bld
|
|
||||||
$f3 ▄███████▄ $f1 ▄██████▄ $f2 ▄██████▄ $f4 ▄██████▄ $f5 ▄██████▄ $f6 ▄██████▄
|
|
||||||
$f3▄█████████▀▀ $f1▄$f7█▀█$f1██$f7█▀█$f1██▄ $f2▄█$f7█ █$f2██$f7█ █$f2█▄ $f4▄█$f7█ █$f4██$f7█ █$f4█▄ $f5▄█$f7█ █$f5██$f7█ █$f5█▄ $f6▄██$f7█▀█$f6██$f7█▀█$f6▄
|
|
||||||
$f3███████▀ $f7▄▄ ▄▄ ▄▄ $f1█$f7▄▄█$f1██$f7▄▄█$f1███ $f2██$f7███$f2██$f7███$f2██ $f4██$f7███$f4██$f7███$f4██ $f5██$f7███$f5██$f7███$f5██ $f6███$f7█▄▄$f6██$f7█▄▄$f6█
|
|
||||||
$f3███████▄ $f7▀▀ ▀▀ ▀▀ $f1████████████ $f2████████████ $f4████████████ $f5████████████ $f6████████████
|
|
||||||
$f3▀█████████▄▄ $f1██▀██▀▀██▀██ $f2██▀██▀▀██▀██ $f4██▀██▀▀██▀██ $f5██▀██▀▀██▀██ $f6██▀██▀▀██▀██
|
|
||||||
$f3 ▀███████▀ $f1▀ ▀ ▀ ▀ $f2▀ ▀ ▀ ▀ $f4▀ ▀ ▀ ▀ $f5▀ ▀ ▀ ▀ $f6▀ ▀ ▀ ▀
|
|
||||||
$rst
|
|
||||||
EOF
|
|
27
bin/pass-get
27
bin/pass-get
|
@ -1,27 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Fetches the FIELD in ENTRY. It expects pass fields to be colon-delimited.
|
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
|
||||||
>&2 echo "Expected two arguments"
|
|
||||||
>&2 echo "pass get ENTRY FIELD"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
entry=$1
|
|
||||||
field=$2
|
|
||||||
|
|
||||||
secrets="$(pass show $entry)"
|
|
||||||
if [[ ! $secrets ]]; then
|
|
||||||
notify-send --urgency=critical "Failed to retrieve $entry"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $field in
|
|
||||||
password) printf "%s" "$(head -n1 <<<"$secrets")" ;;
|
|
||||||
otp) printf "%s" "$(pass otp "$entry")" ;;
|
|
||||||
*) printf "%s" "$(awk -v "key=$field:" '$1 == key {print $2}' <<<"$secrets")" ;;
|
|
||||||
esac | xsel -i -b -t 15000
|
|
||||||
|
|
||||||
#
|
|
||||||
echo "Copied $entry:$field to clipboard for 15s"
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Interactively generates an OTP-auth url (written for pass-otp)
|
|
||||||
#
|
|
||||||
# Example: passotpuri LABEL SECRET [QUERYSTRING]
|
|
||||||
|
|
||||||
read -p "Enter the label or issuer:" label
|
|
||||||
read -p "Enter its OTP secret:" secret
|
|
||||||
read -p "Enter type (leave blank for totp):" type
|
|
||||||
|
|
||||||
echo "otpauth://${type:-totp}/$label?secret=$secret&issuer=${issuer:-$label}"
|
|
4
bin/pomo
4
bin/pomo
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# A minimalistic pomodoro timer.
|
|
||||||
# e.g. pomo 25 "Hello!"
|
|
||||||
sleep $((${1:-25} * 60)) && notify-send "($(date +%H:%M)) ${2:-Break time!}" && ding &
|
|
57
bin/pushover
57
bin/pushover
|
@ -1,57 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
#
|
|
||||||
# Sends a pushover notification.
|
|
||||||
#
|
|
||||||
# -t [TITLE]
|
|
||||||
# -m [MESSAGE]
|
|
||||||
# -p [PRIORITY_LEVEL]
|
|
||||||
# -u [URL]
|
|
||||||
# -U [URL_TITLE]
|
|
||||||
# -d [DEVICE]
|
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
|
||||||
unset CDPATH
|
|
||||||
|
|
||||||
secret_file=~/.secrets/pushover
|
|
||||||
if [[ ! -f $secret_file ]]; then
|
|
||||||
>&2 echo "No pushover config file found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
title=${2:+$1}
|
|
||||||
message=${2:-$1}
|
|
||||||
# priority=
|
|
||||||
url=
|
|
||||||
url_title=
|
|
||||||
device=
|
|
||||||
|
|
||||||
while getopts t:m:p:u:d: opt; do
|
|
||||||
case $opt in
|
|
||||||
t) title="$OPTARG" ;;
|
|
||||||
m) message="$OPTARG" ;;
|
|
||||||
# p) priority="$OPTARG" ;;
|
|
||||||
u) url="$OPTARG" ;;
|
|
||||||
U) url_title="$OPTARG" ;;
|
|
||||||
d) device="$OPTARG" ;;
|
|
||||||
*) >&2 echo "Invalid option $OPTARG"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
shift $((OPTIND-1))
|
|
||||||
|
|
||||||
#USER=...
|
|
||||||
#TOKEN=...
|
|
||||||
eval "$(gpg --decrypt $secret_file)"
|
|
||||||
|
|
||||||
curl -s \
|
|
||||||
--form-string "token=$TOKEN" \
|
|
||||||
--form-string "user=$USER" \
|
|
||||||
--form-string "title=$title" \
|
|
||||||
--form-string "message=$message" \
|
|
||||||
--form-string "url=$url" \
|
|
||||||
--form-string "url_title=$url_title" \
|
|
||||||
--form-string "device=$device" \
|
|
||||||
https://api.pushover.net/1/messages.json
|
|
16
bin/qrsnap
16
bin/qrsnap
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Snaps a screenshot of a QR code and decodes it.
|
|
||||||
#
|
|
||||||
# Requires: zbar, maim (on linux)
|
|
||||||
|
|
||||||
set -e
|
|
||||||
unset CDPATH
|
|
||||||
TMP=$(mktemp _qrXXX)
|
|
||||||
case $OSTYPE in
|
|
||||||
darwin*) screencapture -i -x -t png "$TMP" ;;
|
|
||||||
linux*) maim -s "$TMP" ;;
|
|
||||||
*) >&2 echo "Help!"; exit 1 ;;
|
|
||||||
esac
|
|
||||||
(( $? == 0 )) && zbarimg -q --raw "$TMP"
|
|
||||||
rm -f "$TMP"
|
|
46
bin/rclip
46
bin/rclip
|
@ -1,46 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# A simple script for sending data to another computer's clipboard via SSH. Acts
|
|
||||||
# as a universal clipboard. This script must be available on the remote. Pipe
|
|
||||||
# through gpg if you want the contents encrypted.
|
|
||||||
#
|
|
||||||
# It helps if your ssh connection is pubkey authenticated and password-less.
|
|
||||||
#
|
|
||||||
# Requires: pb (script, in same folder)
|
|
||||||
#
|
|
||||||
# Workflow:
|
|
||||||
# host $ echo "Hello world!" | rclip guest
|
|
||||||
# guest $ rclip
|
|
||||||
# Hello world!
|
|
||||||
# OR
|
|
||||||
# host $ echo "Hello world!" | gpg -e | rclip.sh guest
|
|
||||||
# guest $ rclip | gpg -d
|
|
||||||
# Hello world!
|
|
||||||
|
|
||||||
bin="${0##*/}"
|
|
||||||
|
|
||||||
flags=
|
|
||||||
while getopts p:i:l: opt; do
|
|
||||||
case $opt in
|
|
||||||
p) flags+=" -p $OPTARG" ;;
|
|
||||||
i) flags+=" -i $OPTARG" ;;
|
|
||||||
l) flags+=" -l $OPTARG" ;;
|
|
||||||
*) >&2 echo "Invalid option $OPTARG"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
shift $((OPTIND-1))
|
|
||||||
|
|
||||||
target="$1"
|
|
||||||
if [[ -n $target ]]; then
|
|
||||||
if [[ -t 0 ]]; then
|
|
||||||
pb | $bin $target
|
|
||||||
else
|
|
||||||
ssh $flags -qt "$target" "pb" && echo "Sent to $target"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
pb
|
|
||||||
fi
|
|
||||||
|
|
||||||
# vim:set ft=sh:
|
|
10
bin/rehash
10
bin/rehash
|
@ -1,10 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
# Rehashes all (rb|py|nod|lua|*)env environments
|
|
||||||
|
|
||||||
for env in $XDG_CONFIG_HOME/*env(N); do
|
|
||||||
local bin=${env##*/}
|
|
||||||
if _is_callable $bin; then
|
|
||||||
echo "Rehashing $bin"
|
|
||||||
$bin rehash
|
|
||||||
fi
|
|
||||||
done
|
|
17
bin/scrcap
Executable file
17
bin/scrcap
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p maim slop xclip libnotify
|
||||||
|
|
||||||
|
# A script that takes a screenshot (prompts you for what region/window to
|
||||||
|
# capture) and stores it in the clipboard.
|
||||||
|
|
||||||
|
tmp=$(mktemp)
|
||||||
|
|
||||||
|
# Delay for long enough that we can refocus the targeted window
|
||||||
|
if maim --delay=${1:-0.6} -us >"$tmp"; then
|
||||||
|
xclip -selection clipboard -t image/png "$tmp" &&
|
||||||
|
notify-send "Screenshot saved"
|
||||||
|
else
|
||||||
|
notify-send -u low "Aborted screenshot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$tmp"
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p ffmpeg slop
|
||||||
|
|
||||||
# Select a region and record it.
|
# Select a region and record it.
|
||||||
#
|
#
|
||||||
|
@ -17,7 +18,7 @@ fi
|
||||||
if [[ -f /tmp/_stop ]]; then
|
if [[ -f /tmp/_stop ]]; then
|
||||||
echo q > /tmp/_stop
|
echo q > /tmp/_stop
|
||||||
if [[ $is_script ]]; then
|
if [[ $is_script ]]; then
|
||||||
ding error &
|
>&2 echo "Nope"
|
||||||
else
|
else
|
||||||
echo "Stopped previous recording"
|
echo "Stopped previous recording"
|
||||||
fi
|
fi
|
||||||
|
@ -32,7 +33,7 @@ if [[ $dest == *.gif ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $is_script ]]; then
|
if [[ $is_script ]]; then
|
||||||
ding &
|
echo "Starting"
|
||||||
touch /tmp/_stop
|
touch /tmp/_stop
|
||||||
ffmpeg -y -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -framerate 30 "${mp4dest:-$dest}" </tmp/_stop
|
ffmpeg -y -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -framerate 30 "${mp4dest:-$dest}" </tmp/_stop
|
||||||
rm -f /tmp/_stop
|
rm -f /tmp/_stop
|
27
bin/sedall
27
bin/sedall
|
@ -1,27 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
unset CDPATH
|
|
||||||
|
|
||||||
# Find and replace by a given list of files.
|
|
||||||
#
|
|
||||||
# replace foo bar **/*.rb
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local search="$1"
|
|
||||||
local replace="$2"
|
|
||||||
shift 2
|
|
||||||
|
|
||||||
for item in $(ag -l --nocolor "$search" "$@"); do
|
|
||||||
sed -ir "s%${search//%/\\%}%${replace//%/\\%}%g" "$item"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Show matches
|
|
||||||
ag "$1"
|
|
||||||
|
|
||||||
# Are you sure?
|
|
||||||
read -rp "Confirm search+replace? (y/n)?" choice
|
|
||||||
case $choice in
|
|
||||||
y|Y) main "$@" ;;
|
|
||||||
*) >&2 echo "Aborted"; exit ;;
|
|
||||||
esac
|
|
143
bin/shekel
143
bin/shekel
|
@ -1,143 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
"""
|
|
||||||
A shell script that converts one currency to another.
|
|
||||||
|
|
||||||
Usage: shekel [-rh] AMOUNT FROM TO [TO ...]
|
|
||||||
|
|
||||||
FROM and TO are currency codes.
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
shekel 200 USD CAD
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
from urllib import request
|
|
||||||
from datetime import datetime
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
API_KEY = "92a7ccb3b6038a7151fc15e99f2de83d" # please use your own!
|
|
||||||
API_URL = "http://apilayer.net/api/live?access_key={}¤cies={},{}"
|
|
||||||
|
|
||||||
DEFAULT_CODES = ('CAD', 'USD')
|
|
||||||
CACHE_FILE = "/tmp/shekel-hist"
|
|
||||||
CACHE_TTL = 3600
|
|
||||||
|
|
||||||
class CurrencyCache():
|
|
||||||
def __init__(self, path=CACHE_FILE, ttl=CACHE_TTL):
|
|
||||||
self.path = Path(path)
|
|
||||||
self.ttl = ttl
|
|
||||||
|
|
||||||
cache = {}
|
|
||||||
if self.path.exists():
|
|
||||||
cache = json.loads(self.path.read_text())
|
|
||||||
self.cache = cache
|
|
||||||
|
|
||||||
def __enter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(self, *args):
|
|
||||||
self.path.write_text(json.dumps(self.cache))
|
|
||||||
|
|
||||||
def clear(self):
|
|
||||||
db = self.cache['_DB']
|
|
||||||
self.cache.clear()
|
|
||||||
self.cache['_DB'] = db
|
|
||||||
|
|
||||||
def store(self, from_code, to_code, rate):
|
|
||||||
self._set("-".join([from_code, to_code]), rate)
|
|
||||||
self._set("-".join([to_code, from_code]), 1 / rate)
|
|
||||||
|
|
||||||
def get(self, from_code, to_code):
|
|
||||||
key = "-".join([from_code, to_code])
|
|
||||||
if key in self.cache:
|
|
||||||
return self.cache[key]['value']
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _set(self, key, value):
|
|
||||||
self.cache[key] = {'time': datetime.now().timestamp(), 'value': value}
|
|
||||||
|
|
||||||
|
|
||||||
def _request_currency_rate(url=API_URL, *args):
|
|
||||||
"""Fetch currency rates from remote API."""
|
|
||||||
real_url = url.format(*map(request.quote, map(str, args)))
|
|
||||||
data = json.loads(request.urlopen(real_url).read().decode('utf-8'))
|
|
||||||
if not data['success']:
|
|
||||||
raise Exception(data['error']['info'])
|
|
||||||
return data["quotes"]
|
|
||||||
|
|
||||||
|
|
||||||
def format_currency(curr):
|
|
||||||
"""Format a currency entry for the FZF prompt."""
|
|
||||||
return "{} {}".format(curr['id'], curr['currencyName'])
|
|
||||||
|
|
||||||
|
|
||||||
def currency_rate(from_code, to_code):
|
|
||||||
"""
|
|
||||||
Retrieves the exchange rate between two currencies.
|
|
||||||
|
|
||||||
:param from_code: an ISO 4217 currency code of the source currency
|
|
||||||
:param to_code: an ISO 4217 currency code of the destination currency
|
|
||||||
:returns: an exchange rate (a float)
|
|
||||||
"""
|
|
||||||
if from_code == to_code:
|
|
||||||
return 1.0
|
|
||||||
elif not from_code or not to_code:
|
|
||||||
return None
|
|
||||||
rates = _request_currency_rate(API_URL, API_KEY, from_code, to_code)
|
|
||||||
try:
|
|
||||||
return (1 / rates["USD" + from_code]) * rates["USD" + to_code]
|
|
||||||
except KeyError as e:
|
|
||||||
print("Could not find currency named {}".format(from_code))
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def each_currency_rate(from_code, to_codes, refresh=False):
|
|
||||||
"""
|
|
||||||
Returns a cached generator for each exchange rate.
|
|
||||||
|
|
||||||
:param from_code: the ISO 4217 currency code of the source currency
|
|
||||||
:param to_codes: a list of ISO 4217 currency codes to convert to
|
|
||||||
:yields: a tuple containg (TO_CODE, EXCHANGE_RATE)
|
|
||||||
"""
|
|
||||||
with CurrencyCache(path=CACHE_FILE, ttl=CACHE_TTL) as cache:
|
|
||||||
if refresh:
|
|
||||||
cache.clear()
|
|
||||||
for code in to_codes:
|
|
||||||
rate = cache.get(from_code, code)
|
|
||||||
if not rate:
|
|
||||||
rate = currency_rate(from_code, code)
|
|
||||||
if rate:
|
|
||||||
cache.store(from_code, code, rate)
|
|
||||||
if not rate:
|
|
||||||
yield (None, None)
|
|
||||||
else:
|
|
||||||
yield (code, rate)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
opts = argparse.ArgumentParser(
|
|
||||||
description="Convert one amount of currency into another, or multiple.")
|
|
||||||
opts.add_argument('amount', type=float, help="The amount to convert")
|
|
||||||
opts.add_argument('src', metavar='from', type=str,
|
|
||||||
help="Currency to convert from")
|
|
||||||
opts.add_argument('dest', metavar='to', type=str, nargs='+',
|
|
||||||
help="Currency(ies) to convert to")
|
|
||||||
opts.add_argument('-r', '--refresh', action='store_true',
|
|
||||||
help="Refresh the cache")
|
|
||||||
args = opts.parse_args()
|
|
||||||
|
|
||||||
try:
|
|
||||||
for code, rate in each_currency_rate(args.src, args.dest, refresh=args.refresh):
|
|
||||||
if code:
|
|
||||||
print("{:.4f} {}".format(rate * args.amount, code))
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("Aborted!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
12
bin/ssclip
12
bin/ssclip
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# A script that takes a screenshot and stores it in the clipboard
|
|
||||||
tmp=$(mktemp)
|
|
||||||
if maim -us >"$tmp"; then
|
|
||||||
xclip -selection clipboard -t image/png "$tmp" && \
|
|
||||||
ding && \
|
|
||||||
notify-send "Screenshot saved"
|
|
||||||
else
|
|
||||||
notify-send -u low "Screenshot aborted"
|
|
||||||
ding error
|
|
||||||
fi
|
|
||||||
rm -f "$tmp"
|
|
34
bin/sup
34
bin/sup
|
@ -1,34 +0,0 @@
|
||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
# Performs an online search. Uses the last used provider, otherwise prompts for
|
|
||||||
# one with skim.
|
|
||||||
|
|
||||||
provider="$1"; shift
|
|
||||||
query="$*"
|
|
||||||
|
|
||||||
typeset -A providers
|
|
||||||
providers+=('DuckDuckGo' 'https://duckduckgo.com/?q=%s')
|
|
||||||
providers+=('DevDocs.io' 'http://devdocs.io/#q=%s')
|
|
||||||
providers+=('Google search' 'https://google.com/search?q=%s')
|
|
||||||
providers+=('Google images' 'https://google.com/images?q=%s')
|
|
||||||
providers+=('Google maps' 'https://maps.google.com/maps?q=%s')
|
|
||||||
providers+=('Project Gutenberg' 'http://www.gutenberg.org/ebooks/search/?query=%s')
|
|
||||||
providers+=('StackOverflow' 'https://stackoverflow.com/search?q=%s')
|
|
||||||
providers+=('Github' 'https://github.com/search?ref=simplesearch&q=%s')
|
|
||||||
providers+=('Youtube' 'https://youtube.com/results?aq=f&oq=&search_query=%s')
|
|
||||||
providers+=('Wolfram alpha' 'https://wolframalpha.com/input/?i=%s')
|
|
||||||
providers+=('Wikipedia' 'https://wikipedia.org/search-redirect.php?language=en&go=Go&search=%s')
|
|
||||||
|
|
||||||
pick=$(printf "%s\n" "${(@k)providers}" | sk --query="$provider" --prompt='provider > ' -1 -0)
|
|
||||||
if [[ -z $pick ]]; then
|
|
||||||
>&2 echo 'No provider selected. Aborting.'
|
|
||||||
exit 1
|
|
||||||
elif [[ -z ${providers[$pick]} ]]; then
|
|
||||||
>&2 echo 'No provider matched that query. Aborting.'
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
url=$(printf "${providers[$pick]}\n" $(uri<<<"$query"))
|
|
||||||
|
|
||||||
echo "Opening $url"
|
|
||||||
open $url
|
|
122
bin/timein
122
bin/timein
|
@ -1,120 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
"""
|
open=open
|
||||||
Retrieves the time (and time difference) at a location (can be an address,
|
[[ $OSTYPE == linux* ]] && open=xdg-open
|
||||||
postal code, country name, etc). Uses Google Maps APIs to map locations to
|
|
||||||
coordinates, and coordinates to timezones.
|
|
||||||
|
|
||||||
Requires: pytz, tzlocal
|
$open https://time.is/$1 2>/dev/null &
|
||||||
Usage: time-in Copenhagen "Toronto, ON" Vancouver
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
from base64 import b64encode
|
|
||||||
from datetime import datetime
|
|
||||||
from urllib import request
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from pytz import timezone
|
|
||||||
from tzlocal import get_localzone
|
|
||||||
|
|
||||||
URL_BASE = "https://maps.googleapis.com/maps/api/"
|
|
||||||
URL_TZ = URL_BASE + "timezone/json?location={},{}×tamp={}"
|
|
||||||
URL_GEOCODE = URL_BASE + "geocode/json?address={}"
|
|
||||||
|
|
||||||
CACHE_FILE = "{}/timein".format(os.environ.get("XDG_CACHE_HOME") or "/tmp")
|
|
||||||
CACHE = {}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
def _generate_url(url, *args):
|
|
||||||
return url.format(*map(request.quote, map(str, args)))
|
|
||||||
|
|
||||||
def _request(url, *args):
|
|
||||||
real_url = url.format(*map(request.quote, map(str, args)))
|
|
||||||
resp = request.urlopen(real_url).read()
|
|
||||||
result = json.loads(resp.decode('utf-8'))
|
|
||||||
if result['status'] == 'OK':
|
|
||||||
return result
|
|
||||||
elif result['status'] != 'UNKNOWN_ERROR':
|
|
||||||
raise Exception(result['error_message'])
|
|
||||||
|
|
||||||
def get_timezone(coords, timestamp):
|
|
||||||
return _request(URL_TZ, coords['lat'], coords['lng'], timestamp)['timeZoneId']
|
|
||||||
|
|
||||||
def get_coords(desc):
|
|
||||||
result = _request(URL_GEOCODE, desc)
|
|
||||||
if 'results' in result:
|
|
||||||
return {"lat": result['results'][0]['geometry']['location']['lat'],
|
|
||||||
"lng": result['results'][0]['geometry']['location']['lng'],
|
|
||||||
"name": result['results'][0]['formatted_address']}
|
|
||||||
|
|
||||||
def cache(key, fn, ttl):
|
|
||||||
if key in CACHE and CACHE[key]['time'] < CACHE[key]['time'] + ttl:
|
|
||||||
return CACHE[key]['value']
|
|
||||||
value = fn()
|
|
||||||
if value is not None:
|
|
||||||
CACHE[key] = {
|
|
||||||
'time': datetime.now().timestamp(),
|
|
||||||
'value': value
|
|
||||||
}
|
|
||||||
return value
|
|
||||||
|
|
||||||
def diff(a, b, absolute=False):
|
|
||||||
"""Returns a timedelta object"""
|
|
||||||
a = a.replace(tzinfo=None)
|
|
||||||
b = b.replace(tzinfo=None)
|
|
||||||
return (max(a, b) - min(a, b), b > a)
|
|
||||||
|
|
||||||
def encode(s):
|
|
||||||
return str(b64encode(s.encode('ascii')))
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
def each_location(locations):
|
|
||||||
"""
|
|
||||||
Enumerates over and maps a list of location strings to time difference data.
|
|
||||||
"""
|
|
||||||
here = get_localzone().localize(datetime.now())
|
|
||||||
for location in locations:
|
|
||||||
coords = cache("coords-" + encode(location),
|
|
||||||
lambda l=location: get_coords(l),
|
|
||||||
86400)
|
|
||||||
if coords:
|
|
||||||
tzname = cache("tz-" + encode(location),
|
|
||||||
lambda c=coords: get_timezone(c, here.timestamp()),
|
|
||||||
1800)
|
|
||||||
then = here.astimezone(timezone(tzname))
|
|
||||||
tdiff, direction = diff(here, then)
|
|
||||||
if tdiff.seconds == 0:
|
|
||||||
suffix = "(same timezone)"
|
|
||||||
elif direction:
|
|
||||||
suffix = "ahead"
|
|
||||||
else:
|
|
||||||
suffix = "behind"
|
|
||||||
|
|
||||||
yield {
|
|
||||||
"name": coords['name'],
|
|
||||||
"then": then.strftime("%b %d, %H:%M:%S %Z%z"),
|
|
||||||
"diff": int(tdiff.seconds / 60 / 60),
|
|
||||||
"suffix": suffix,
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
yield None
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
assert sys.argv[1:], "Usage: {} [LOCATION]".format(sys.argv[0])
|
|
||||||
|
|
||||||
cachefp = Path(CACHE_FILE)
|
|
||||||
CACHE = json.loads(cachefp.read_text()) if cachefp.exists() else {}
|
|
||||||
|
|
||||||
for data in each_location(sys.argv[1:]):
|
|
||||||
if data:
|
|
||||||
print("{name:24} {then}\t{diff}h {suffix}".format(**data))
|
|
||||||
else:
|
|
||||||
print("Couldn't find {name} or something went wrong".format(**data), file=sys.stderr)
|
|
||||||
|
|
||||||
cachefp.write_text(json.dumps(CACHE))
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if (( $# == 0 )); then
|
|
||||||
>&2 echo "Forgot to specify a destination filename. Aborting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Upload file/stdin to transfer.sh
|
|
||||||
url="https://transfer.sh"
|
|
||||||
tmpfile=$(mktemp -t transferXXX)
|
|
||||||
cleanup() { rm -f "$tmpfile"; }
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
if tty -s; then
|
|
||||||
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
|
|
||||||
curl --progress-bar --upload-file "$1" "$url/$basefile" >>"$tmpfile"
|
|
||||||
else
|
|
||||||
curl --progress-bar --upload-file "-" "$url/$1" >>"$tmpfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat "$tmpfile" | clip
|
|
||||||
cat "$tmpfile"
|
|
37
bin/uri
37
bin/uri
|
@ -1,37 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
"""
|
|
||||||
Encode/decode url strings in stdin or the given file(s).
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import fileinput
|
|
||||||
try:
|
|
||||||
from urllib.parse import quote_plus, quote, unquote_plus, unquote
|
|
||||||
except ImportError:
|
|
||||||
from urllib import quote_plus, quote, unquote_plus, unquote
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
opts = argparse.ArgumentParser(description="Make text URI-safe by encoding/decoding input")
|
|
||||||
opts.add_argument('file', type=str, nargs='*', help='File(s) to encode/decode')
|
|
||||||
opts.add_argument('-e', '--encode', action='store_true', help='Use encoder')
|
|
||||||
opts.add_argument('-E', '--encode-plus', action='store_true', help='Use encoder, but encode spaces as pluses')
|
|
||||||
opts.add_argument('-d', '--decode', action='store_true', help='Use decoder')
|
|
||||||
opts.add_argument('-D', '--decode-plus', action='store_true', help='Use decoder, but decode pluses as spaces')
|
|
||||||
args = opts.parse_args()
|
|
||||||
|
|
||||||
action = quote
|
|
||||||
if args.decode:
|
|
||||||
action = unquote
|
|
||||||
elif args.decode_plus:
|
|
||||||
action = unquote_plus
|
|
||||||
elif args.encode_plus:
|
|
||||||
action = quote_plus
|
|
||||||
|
|
||||||
text = [line for line in fileinput.input(args.file)]
|
|
||||||
print(action("\n".join(text).strip()))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
41
bootstrap.sh
41
bootstrap.sh
|
@ -1,41 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# dotfiles bootstrapper
|
|
||||||
#
|
|
||||||
# Installs zsh & git, then clones this repo to ~/.dotfiles. This script is
|
|
||||||
# intended to be run remotely, via curl:
|
|
||||||
#
|
|
||||||
# bash <(curl -s https://raw.githubusercontent.com/hlissner/dotfiles/master/bootstrap.sh)
|
|
||||||
|
|
||||||
export DOTFILES=~/.dotfiles
|
|
||||||
set -e
|
|
||||||
|
|
||||||
_msg() { printf "\r\033[2K\033[0;32m[ .. ] %s\033[0m\n" "$*"; }
|
|
||||||
_uncallable() { ! command -v "$1" >/dev/null; }
|
|
||||||
|
|
||||||
if _uncallable zsh || _uncallable git; then
|
|
||||||
# NOTE Macos has both already
|
|
||||||
_msg "Installing git and/or zsh"
|
|
||||||
if [[ -f /etc/arch-release ]]; then
|
|
||||||
sudo pacman --needed --noconfirm -S git zsh
|
|
||||||
elif [[ -f /etc/debian_version ]]; then
|
|
||||||
sudo apt-get update && sudo apt-get install -y git zsh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d ~/.dotfiles ]]; then
|
|
||||||
_msg "Deploying dotfiles repository..."
|
|
||||||
if [[ $USER == hlissner ]]; then
|
|
||||||
dfrepo=git@github.com:hlissner/dotfiles.git
|
|
||||||
else
|
|
||||||
dfrepo=https://github.com/hlissner/dotfiles
|
|
||||||
fi
|
|
||||||
git clone --recursive "$dfrepo" "$DOTFILES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
_msg
|
|
||||||
_msg "And done!"
|
|
||||||
_msg
|
|
||||||
_msg "Use $DOTFILES/deploy to install your dotfiles, I suggest you begin"
|
|
||||||
_msg "with 'base/arch' or 'base/macos'."
|
|
29
config/bspwm/bspwmrc
Executable file
29
config/bspwm/bspwmrc
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export MONITOR=$(xrandr -q | grep primary | cut -d' ' -f1)
|
||||||
|
export MONITORS=( $(xrandr -q | grep ' connected' | cut -d' ' -f1) )
|
||||||
|
MONITOR=${MONITOR:-${MONITORS[0]}}
|
||||||
|
|
||||||
|
# Only have workspaces for primary monitor
|
||||||
|
bspc monitor $MONITOR -d {1,2,3,4,5}
|
||||||
|
|
||||||
|
bspc config remove_disabled_monitors true
|
||||||
|
bspc config remove_unplugged_monitors true
|
||||||
|
|
||||||
|
|
||||||
|
# Rules
|
||||||
|
bspc rule -r '*'
|
||||||
|
|
||||||
|
bspc rule -a 'Emacs:org*' state=floating
|
||||||
|
bspc rule -a mpv state=floating center=on
|
||||||
|
bspc rule -a Pinentry state=floating center=on
|
||||||
|
bspc rule -a Emacs split_ratio=0.32 border=off state=fullscreen
|
||||||
|
bspc rule -a Firefox split_ratio=0.32
|
||||||
|
bspc rule -a feh state=fullscreen
|
||||||
|
bspc rule -a st-scratch state=floating sticky=on center=on
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
for file in $XDG_CONFIG_HOME/bspwm/rc.d/*; do
|
||||||
|
source "$file"
|
||||||
|
done
|
17
config/emacs/aliases.zsh
Normal file
17
config/emacs/aliases.zsh
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
if [[ $OSTYPE == darwin* ]]; then
|
||||||
|
alias emacs='emacs -nw'
|
||||||
|
|
||||||
|
e() { # Emacs version of v
|
||||||
|
if pgrep Emacs 2>&1 >/dev/null; then
|
||||||
|
emacsclient -n $@
|
||||||
|
else
|
||||||
|
/Applications/Emacs.app/Contents/MacOS/Emacs $@ &
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
else
|
||||||
|
alias e='emacsclient -n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
ediff() { e --eval "(ediff-files \"$1\" \"$2\")"; }
|
3
config/emacs/env.zsh
Normal file
3
config/emacs/env.zsh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
export PATH="$HOME/.emacs.d/bin:$PATH"
|
62
config/firefox/stylus.json
Normal file
62
config/firefox/stylus.json
Normal file
File diff suppressed because one or more lines are too long
30
config/git/aliases.zsh
Normal file
30
config/git/aliases.zsh
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
g() { [[ $# = 0 ]] && git status --short . || git $*; }
|
||||||
|
compdef g=hub
|
||||||
|
|
||||||
|
alias git='noglob hub'
|
||||||
|
alias ga='git add'
|
||||||
|
alias gap='git add --patch'
|
||||||
|
alias gb='git branch'
|
||||||
|
alias gbr='git browse'
|
||||||
|
alias gbl='git blame'
|
||||||
|
alias gc='git commit'
|
||||||
|
alias gcm='git commit -m'
|
||||||
|
alias gca='git commit --amend'
|
||||||
|
alias gcf='git commit --fixup'
|
||||||
|
alias gcl='git clone'
|
||||||
|
alias gco='git checkout'
|
||||||
|
alias gcoo='git checkout --'
|
||||||
|
alias gf='git fetch'
|
||||||
|
alias gi='git init'
|
||||||
|
alias gl='git log --graph --pretty="format:%C(yellow)%h%Creset %C(red)%G?%Creset%C(green)%d%Creset %s %Cblue(%cr) %C(bold blue)<%aN>%Creset"'
|
||||||
|
alias gll='git log --pretty="format:%C(yellow)%h%Creset %C(red)%G?%Creset%C(green)%d%Creset %s %Cblue(%cr) %C(bold blue)<%aN>%Creset"'
|
||||||
|
alias gL='gl --stat'
|
||||||
|
alias gp='git push'
|
||||||
|
alias gpl='git pull --rebase --autostash'
|
||||||
|
alias gs='git status --short .'
|
||||||
|
alias gss='git status'
|
||||||
|
alias gst='git stash'
|
||||||
|
alias gr='git reset HEAD'
|
||||||
|
alias grv='git rev-parse'
|
|
@ -1,22 +1,17 @@
|
||||||
[user]
|
[user]
|
||||||
name = Henrik Lissner
|
name = Henrik Lissner
|
||||||
email = henrik@lissner.net
|
email = henrik@lissner.net
|
||||||
|
signingkey = 5F6C0EA160557395
|
||||||
|
[commit]
|
||||||
|
gpgsign = true
|
||||||
[core]
|
[core]
|
||||||
pager = diff-so-fancy | less --tabs=4 -RFX
|
|
||||||
whitespace = trailing-space
|
whitespace = trailing-space
|
||||||
[color]
|
|
||||||
ui = auto
|
|
||||||
[github]
|
[github]
|
||||||
user = hlissner
|
user = hlissner
|
||||||
[rebase]
|
[rebase]
|
||||||
autosquash = true
|
autosquash = true
|
||||||
[push]
|
[push]
|
||||||
default = current
|
default = current
|
||||||
[merge]
|
|
||||||
ff = onlt
|
|
||||||
log = true
|
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
amend = commit --amend
|
amend = commit --amend
|
||||||
exec = "!exec "
|
exec = "!exec "
|
||||||
|
@ -30,7 +25,7 @@
|
||||||
emails = !git log --format="%aE" | sort -u
|
emails = !git log --format="%aE" | sort -u
|
||||||
email-domains = !git log --format="%aE" | awk -F'@' '{print $2}' | sort -u
|
email-domains = !git log --format="%aE" | awk -F'@' '{print $2}' | sort -u
|
||||||
[filter "lfs"]
|
[filter "lfs"]
|
||||||
|
required = true
|
||||||
smudge = git-lfs smudge -- %f
|
smudge = git-lfs smudge -- %f
|
||||||
process = git-lfs filter-process
|
process = git-lfs filter-process
|
||||||
required = true
|
|
||||||
clean = git-lfs clean -- %f
|
clean = git-lfs clean -- %f
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue