summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbackup.sh2
-rwxr-xr-xch1
-rwxr-xr-xconnect-screen50
-rwxr-xr-xdump-ff-history2
-rwxr-xr-xmasterkey-sign.sh8
-rwxr-xr-xmasterkey.pl11
-rwxr-xr-xmute-toggle3
-rwxr-xr-xpulse-loopback9
-rwxr-xr-xqrcode3
-rwxr-xr-xsetup-noise-suppression2
-rwxr-xr-xsupercherry7
-rwxr-xr-xsvn-commit-git-patch8
-rwxr-xr-xwg-genkey6
13 files changed, 101 insertions, 11 deletions
diff --git a/backup.sh b/backup.sh
index 7b07c63..f1a90e8 100755
--- a/backup.sh
+++ b/backup.sh
@@ -127,7 +127,7 @@ backup_borg() {
local src=("$@")
local -a options=(
--verbose
- --numeric-owner
+ --numeric-ids
--compression lz4
--exclude-from "$TMPDIR/exclude-list-borg"
)
diff --git a/ch b/ch
index c875649..b76acaa 100755
--- a/ch
+++ b/ch
@@ -190,6 +190,7 @@ chclean() {
chclean-single() {
__chrootalias_resolve_create "$1" || return
if [[ -e $copydir ]]; then
+ sudo btrfs subvolume delete "$copydir/var/lib/portables" || true
sudo btrfs subvolume delete "$copydir/var/lib/machines" || true
sudo btrfs subvolume delete "$copydir"
sudo rm -f "${copydir%/}.lock"
diff --git a/connect-screen b/connect-screen
index 8c65078..4f4403e 100755
--- a/connect-screen
+++ b/connect-screen
@@ -4,16 +4,46 @@ xrandr --output VIRTUAL1 --off
xrandr --output HDMI2 --off
xrandr --output DP1 --off
xrandr --output DP2 --off
+xrandr --output DP1-1 --off
+xrandr --output DP1-2 --off
+xrandr --output DP2-1 --off
+xrandr --output DP2-2 --off
xset r rate 250 50
has_hdmi2=$(xrandr | grep '^HDMI2 connected')
has_dp1=$(xrandr | grep '^DP1 connected')
+has_dp1_1=$(xrandr | grep '^DP1-1 connected')
+has_dp1_2=$(xrandr | grep '^DP1-2 connected')
has_dp2=$(xrandr | grep '^DP2 connected')
+has_dp2_2=$(xrandr | grep '^DP2-2 connected')
-if [[ $has_hdmi2 && $has_dp1 ]]; then
- xrandr --output DP1 --right-of eDP1 --auto
+output_left=""
+output_right=""
+
+if [[ $has_dp1_1 && $has_dp1_2 ]]; then
+ xrandr --output DP1-2 --right-of eDP1 --mode 640x480 -r 60
+ xrandr --output DP1-1 --right-of DP1-2 --mode 2560x1440 -r 60
+ xrandr --output DP1-1 --primary
+ output_left=DP1-2
+ output_right=DP1-1
+elif [[ $has_hdmi2 && $has_dp1_2 ]]; then
+ xrandr --output DP1-2 --right-of eDP1 --auto
+ xrandr --output HDMI2 --right-of DP1-2 --auto
+ xrandr --output DP1-2 --primary
+ output_left=DP1-2
+ output_right=HDMI2
+elif [[ $has_hdmi2 && $has_dp1 ]]; then
+ xrandr --output DP1-1 --right-of eDP1 --auto
xrandr --output HDMI2 --right-of DP1 --auto
xrandr --output DP1 --primary
+ output_left=DP1-1
+ output_right=HDMI2
+elif [[ $has_dp1 && $has_dp2_2 ]]; then
+ xrandr --output DP2-2 --right-of eDP1 --auto
+ xrandr --output DP1 --right-of DP2-2 --auto
+ xrandr --output DP2-2 --primary
+ output_left=DP2-2
+ output_right=DP1
else
if [[ $has_hdmi2 ]]; then
xrandr --output HDMI2 --right-of eDP1 --auto
@@ -31,3 +61,19 @@ else
fi
xkbcomp .xkbmap "$DISPLAY"
+
+# Reorganize workspaces across displays
+if [[ $output_left != "" ]] && [[ $output_right != "" ]]; then
+ workspaces_left=(3 4)
+ workspaces_right=(1 2 5 6 7 8 9 10 11 12 13 14 15)
+ for workspace in "${workspaces_left[@]}"; do
+ i3-msg "[workspace=\"$workspace\"]" move workspace to output $output_left
+ done
+
+ for workspace in "${workspaces_right[@]}"; do
+ i3-msg "[workspace=\"$workspace\"]" move workspace to output $output_right
+ done
+
+ i3-msg "workspace 3"
+ i3-msg "workspace 1"
+fi
diff --git a/dump-ff-history b/dump-ff-history
index 5f16837..33cf7f0 100755
--- a/dump-ff-history
+++ b/dump-ff-history
@@ -5,7 +5,7 @@ trap "rm -rf '${TMPDIR}'" EXIT TERM
cp -n ~/.mozilla/firefox/*.default/places.sqlite* "$TMPDIR"
-sqlite3 "$TMPDIR/places.sqlite" "SELECT datetime(visit_date/1000000,'unixepoch') AS visit_date, url, title
+sqlite3 "$TMPDIR/places.sqlite" "SELECT datetime(visit_date/1000000,'unixepoch', 'localtime') AS visit_date, url, title
FROM moz_places, moz_historyvisits
WHERE moz_places.id = moz_historyvisits.place_id AND visit_date/1000000 > $(date +%s -d "${1:-2 months ago}") AND visit_date/1000000 < $(date +%s -d "${2:-now}")
ORDER BY visit_date"
diff --git a/masterkey-sign.sh b/masterkey-sign.sh
index 4ea97ce..c83974b 100755
--- a/masterkey-sign.sh
+++ b/masterkey-sign.sh
@@ -4,8 +4,16 @@ set -e
key=$1
+TMPDIR="$(mktemp -d "/tmp/${0##*/}.XXXXXX")"
+trap "rm -rf '${TMPDIR}'" EXIT TERM
+
gpg --quiet --recv-keys "$key"
# this signs ALL uids...
#printf 'y\ny\n' | gpg --default-key 0xA88E23E377514E00 --command-fd 0 --batch --quiet --sign-key "$key"
gpg --default-key 0xA88E23E377514E00 --only-sign-text-ids --edit-key "$key"
gpg --send-keys "$key"
+
+cd ~/git/arch/archlinux-keyring
+
+gpg --export "$key" > "$TMPDIR/key"
+./keyringctl import "$TMPDIR/key"
diff --git a/masterkey.pl b/masterkey.pl
index f3b18cf..d24a5a5 100755
--- a/masterkey.pl
+++ b/masterkey.pl
@@ -46,9 +46,9 @@ sub main {
'body' => 'Hi,
This mail is about having your GPG key signed by an Arch Linux master key.
-Please reply with an email that is signed with your key ({$recipient_key})
+Please reply with an email that is signed with your key or a subkey of it ({$recipient_key})
and contains the token listed below. It is not necessary to encrypt the mail,
-however, signing the mail with your key is required.
+however, signing the mail with your key or a subkey of it is required.
If you do not have GPG configured in your mail client, it is sufficient to
send the signed token as an attachment.
@@ -144,19 +144,22 @@ fun gpg_get_users($key) {
my $user = Encode::decode('utf8', $uid->as_string);
unless ($user =~ m/^(?<name>.*?) (?:\((?<comment>.*?)\) )?\<(?<email>.*?@.*?)\>$/) {
- die "Failed to parse GPG user information for key $key; got $user";
+ warn "Warning: Failed to parse GPG user information for key $key; got '$user'. Ignoring...\n";
}
push @users, {%+};
}
+ die "Failed to parse even one UID from key. Giving up" unless (0+@users > 0);
+
return \@users;
}
fun gpg_get_user($key, $email_regex) {
my $users = gpg_get_users($key);
- return $users->[0] if $users->@* == 1;
+ # Disable this since we only want to use the userid matching the regex
+ #return $users->[0] if $users->@* == 1;
my $user = first {$_->{email} =~ m/$email_regex/} $users->@*;
diff --git a/mute-toggle b/mute-toggle
new file mode 100755
index 0000000..e3359eb
--- /dev/null
+++ b/mute-toggle
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+bash -c "pacmd list-sources | grep -oP 'index: \\d+' | awk '{ print \$2 }' | xargs -I{} pactl set-source-mute {} ${1:-toggle}"
diff --git a/pulse-loopback b/pulse-loopback
new file mode 100755
index 0000000..a756746
--- /dev/null
+++ b/pulse-loopback
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+source=$1
+
+id=$(pactl load-module module-loopback channels=1 source=$source)
+echo "$id"
+trap "pactl unload-module $id" EXIT TERM INT
+echo "press enter to remove loopback"
+read
diff --git a/qrcode b/qrcode
new file mode 100755
index 0000000..3051792
--- /dev/null
+++ b/qrcode
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+qrencode -o - "$1" --size 5 | feh -
diff --git a/setup-noise-suppression b/setup-noise-suppression
index 699ca42..dd0e9ce 100755
--- a/setup-noise-suppression
+++ b/setup-noise-suppression
@@ -14,7 +14,7 @@ channels="${3:-2}"
pacmd unload-module module-null-sink
pacmd load-module module-null-sink sink_name=mic_denoised_out rate=48000 format=s16le
-pacmd load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono plugin=/usr/lib/ladspa/librnnoise_ladspa.so control="$control"
+pacmd load-module module-ladspa-sink sink_name=mic_raw_in sink_master=mic_denoised_out label=noise_suppressor_mono plugin=/usr/lib/ladspa/librnnoise_ladspa.so control="$control",20,0,0,0
pacmd load-module module-loopback source="$source" sink=mic_raw_in channels="$channels" source_dont_move=true sink_dont_move=true latency_msec=1
# remap to regular source for chromium
diff --git a/supercherry b/supercherry
index fad2460..568b342 100755
--- a/supercherry
+++ b/supercherry
@@ -5,6 +5,11 @@
base="${1:-master}"
+remotes=("${@:2}")
+
+if [[ "${#remotes[@]}" -eq 0 ]]; then
+ remotes=(refs/remotes)
+fi
RED="\e[1;31m"
GREEN="\e[0;32m"
@@ -15,7 +20,7 @@ GRAY="\e[0;37m"
NONE="\e[0;0m"
-for ref in $(git for-each-ref --format='%(refname)' refs/remotes); do
+for ref in $(git for-each-ref --format='%(refname)' "${remotes[@]}"); do
sha1="$(git rev-parse --verify $ref)"
if [ "$(git merge-base $ref $base)" = "$sha1" ]; then
continue
diff --git a/svn-commit-git-patch b/svn-commit-git-patch
index 54b345d..b25be44 100755
--- a/svn-commit-git-patch
+++ b/svn-commit-git-patch
@@ -49,5 +49,11 @@ while (my $line = <$fh>) {
$message = "$subject\n\n$message";
-system(qw(svn patch --strip 1), $patchfile);
+system(qw(patch -p 3 -i), $patchfile);
+
+system(qw(svn diff));
+
+print "Commit message will be:\n$message\n\n\n";
+print "Press Enter to commit";
+<STDIN>;
system(qw(svn commit -m), $message);
diff --git a/wg-genkey b/wg-genkey
new file mode 100755
index 0000000..d7410e4
--- /dev/null
+++ b/wg-genkey
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+key=$(wg genkey)
+echo "private: $key"
+printf "public: "
+wg pubkey <<<"$key"