Initial commit

This commit is contained in:
Empathic Qubit 2025-01-24 10:01:12 +01:00
commit f9d88a6c3b
77 changed files with 7678 additions and 0 deletions

0
.Xmodmap Normal file
View file

131
.bash_aliases Normal file
View file

@ -0,0 +1,131 @@
#! /bin/bash
# This is just a bootstrap file for the .d folder. Don't put anything meaninguful here.
__bashrc_debug_startup=${__bashrc_debug_startup:-0}
if ((_bashrc_debug_startup)) ; then
PS4='+ $EPOCHREALTIME\011 '
exec 3>&2 2>/tmp/bashstart.$$.log
set -x
fi
function rlbashrc {
source "$HOME/.bashrc"
}
function getmac {
echo 00:$(head -c5 /dev/urandom | hexdump -e '"%02x"' | sed -r 's/(..)/\1:/g;s/:$//;')
}
function find {
if which gfind &>/dev/null ; then
gfind "$@"
else
command find "$@"
fi
}
function readlink {
if which greadlink &>/dev/null ; then
greadlink "$@"
else
command readlink "$@"
fi
}
__bashrc_debug_order=${__bashrc_debug_order:-0}
# This is here so we don't have to modify the distro provided bashrc.
if [ -d "$HOME/.bashrc.d" ] ; then
while read FILE ; do
if ((__bashrc_debug_order > 0)) ; then
echo "$FILE"
fi
. "$FILE"
# It's a bit stupid that I need to do this.
done < <( find "$HOME/.bashrc.d/." -maxdepth 1 -type f -executable | sort )
fi
# For secrets and commands we don't want to commit to git.
if [ -d "$HOME/.bashrc.local.d" ] ; then
while read FILE ; do
. "$FILE"
done < <( find "$HOME/.bashrc.local.d/." -type f -executable | sort )
fi
export EDITOR='vim'
# wrap_alias takes three arguments:
# $1: The name of the alias
# $2: The command used in the alias
# $3: The arguments in the alias all in one string
# Generate a wrapper completion function (completer) for an alias
# based on the command and the given arguments, if there is a
# completer for the command, and set the wrapper as the completer for
# the alias.
function wrap_alias() {
[[ "$#" == 3 ]] || return 1
local alias_name="$1"
local aliased_command="$2"
local alias_arguments="$3"
local num_alias_arguments
local completion
IFS= read -r num_alias_arguments < <(wc -w <<< "$alias_arguments")
# The completion currently being used for the aliased command.
IFS= read -r completion < <(complete -p $aliased_command 2>/dev/null)
# Only a completer based on a function can be wrapped so look for -F
# in the current completion. This check will also catch commands
# with no completer for which $completion will be empty.
grep -q -- -F <<< "$completion" || return 0
local namespace=alias_completion::
# Extract the name of the completion function from a string that
# looks like: something -F function_name something
# First strip the beginning of the string up to the function name by
# removing "* -F " from the front.
local completion_function=${completion##* -F }
# Then strip " *" from the end, leaving only the function name.
completion_function=${completion_function%% *}
# Try to prevent an infinite loop by not wrapping a function
# generated by this function. This can happen when the user runs
# this twice for an alias like ls='ls --color=auto' or alias l='ls'
# and alias ls='l foo'
[[ "${completion_function#$namespace}" != $completion_function ]] && return 0
local wrapper_name="${namespace}${alias_name}"
eval "
function ${wrapper_name}() {
let COMP_CWORD+=$num_alias_arguments
args=( \"${alias_arguments}\" )
COMP_WORDS=( $aliased_command \${args[@]} \${COMP_WORDS[@]:1} )
$completion_function
}
"
# To create the new completion we use the old one with two
# replacements:
# 1) Replace the function with the wrapper.
local new_completion=${completion/-F * /-F $wrapper_name }
# 2) Replace the command being completed with the alias.
new_completion="${new_completion% *} $alias_name"
eval "$new_completion"
}
# For each defined alias, extract the necessary elements and use them
# to call wrap_alias.
eval "$(alias -p | sed -e 's/alias \([^=][^=]*\)='\''\([^ ][^ ]*\) *\(.*\)'\''/wrap_alias \1 \2 '\''\3'\'' /')"
unset wrap_alias
if ((_bashrc_debug_startup)) ; then
set +x
exec 2>&3 3>&-
fi

9
.bash_logout Normal file
View file

@ -0,0 +1,9 @@
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi
__kill_promptutilserver

44
.bashrc.d/00-path.sh Executable file
View file

@ -0,0 +1,44 @@
#! /bin/bash
export PATH="$PATH:$HOME/script:$HOME/.vim/plugged/github:$HOME/bin:$HOME/.local/bin:~/.pyenv/bin:$HOME/c64-devkit/bin:/usr/lib/goattracker:$HOME/.nix-profile/bin:$HOME/google-cloud-sdk/bin:$HOME/go/bin:$HOME/flutter/bin"
function addpythonpath () {
local PY3PATH
local PYPATH
if which python &>/dev/null ; then
PYPATH="$(python -c 'import sys ; print(sys.path)' | tr "'" '"' | jq -r ".[] | select(contains(\"$HOME\"))" | awk -F'/lib/' '{print $1}')/bin"
PATH="$PATH:$PYPATH"
fi
if which python3 &>/dev/null ; then
PY3PATH="$(python3 -c 'import sys ; print(sys.path)' | tr "'" '"' | jq -r ".[] | select(contains(\"$HOME\"))" | awk -F'/lib/' '{print $1}')/bin"
PATH="$PATH:$PY3PATH"
fi
}
addpythonpath
function addcondapath () {
local each
for each in "/usr/local/anaconda"*"/bin" ; do
export PATH="$PATH:$each"
done
}
addcondapath
for gempath in $HOME/.gem/ruby/*/bin ; do
export PATH="$PATH:$gempath"
done
export HISTCONTROL=ignorespace:ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
if [ ! -z "$DISPLAY" ] ; then
export TMOUT= # never time out if we're graphical
else
export TMOUT=$((5*60)) # use a less crazy timeout than the system default
fi

2
.bashrc.d/01-brew.sh Executable file
View file

@ -0,0 +1,2 @@
#! /bin/bash
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

14
.bashrc.d/02-walktoroot.sh Executable file
View file

@ -0,0 +1,14 @@
#! /bin/bash
function walktoroot {
local DIR="$1"
shift
if [ "$DIR" = "/" ]; then
return
fi
if ! "$@" "$DIR" ; then
local PARENTDIR="$(dirname "$DIR")"
walktoroot "$PARENTDIR" "$@"
fi
}

341
.bashrc.d/03-preexec.sh Executable file
View file

@ -0,0 +1,341 @@
#!/bin/bash
#
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
# https://github.com/rcaloras/bash-preexec
#
#
# 'preexec' functions are executed before each interactive command is
# executed, with the interactive command as its argument. The 'precmd'
# function is executed before each prompt is displayed.
#
# Author: Ryan Caloras (ryan@bashhub.com)
# Forked from Original Author: Glyph Lefkowitz
#
# V0.3.7
#
# General Usage:
#
# 1. Source this file at the end of your bash profile so as not to interfere
# with anything else that's using PROMPT_COMMAND.
#
# 2. Add any precmd or preexec functions by appending them to their arrays:
# e.g.
# precmd_functions+=(my_precmd_function)
# precmd_functions+=(some_other_precmd_function)
#
# preexec_functions+=(my_preexec_function)
#
# 3. Consider changing anything using the DEBUG trap or PROMPT_COMMAND
# to use preexec and precmd instead. Preexisting usages will be
# preserved, but doing so manually may be less surprising.
#
# Note: This module requires two Bash features which you must not otherwise be
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you override
# either of these after bash-preexec has been installed it will most likely break.
# Avoid duplicate inclusion
if [[ "$__bp_imported" == "defined" ]]; then
return 0
fi
__bp_imported="defined"
# Should be available to each precmd and preexec
# functions, should they want it.
__bp_last_ret_value="$?"
__bp_last_argument_prev_command="$_"
__bp_inside_precmd=0
__bp_inside_preexec=0
__bp_time_functions=0
# Remove ignorespace and or replace ignoreboth from HISTCONTROL
# so we can accurately invoke preexec with a command from our
# history even if it starts with a space.
__bp_adjust_histcontrol() {
local histcontrol
histcontrol="${HISTCONTROL//ignorespace}"
# Replace ignoreboth with ignoredups
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
histcontrol="ignoredups:${histcontrol//ignoreboth}"
fi;
export HISTCONTROL="$histcontrol"
}
# This variable describes whether we are currently in "interactive mode";
# i.e. whether this shell has just executed a prompt and is waiting for user
# input. It documents whether the current command invoked by the trace hook is
# run interactively by the user; it's set immediately after the prompt hook,
# and unset as soon as the trace hook is run.
__bp_preexec_interactive_mode=""
__bp_trim_whitespace() {
local var=$@
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}
# This function is installed as part of the PROMPT_COMMAND;
# It sets a variable to indicate that the prompt was just displayed,
# to allow the DEBUG trap to know that the next command is likely interactive.
__bp_interactive_mode() {
__bp_preexec_interactive_mode="on";
}
__bp_precmd_invoke_cmd_loop() {
# Invoke every function defined in our function array.
local precmd_function
for precmd_function in "${precmd_functions[@]}"; do
# Only execute this function if it actually exists.
# Test existence of functions with: declare -[Ff]
if type -t "$precmd_function" 1>/dev/null; then
__bp_set_ret_value "$__bp_last_ret_value" "$__bp_last_argument_prev_command"
# Quote our function invocation to prevent issues with IFS
if (( __bp_time_functions > 0 )) ; then
echo "$precmd_function"
time "$precmd_function"
else
"$precmd_function"
fi
fi
done
}
# This function is installed as part of the PROMPT_COMMAND.
# It will invoke any functions defined in the precmd_functions array.
__bp_precmd_invoke_cmd() {
# Save the returned value from our last command. Note: this MUST be the
# first thing done in this function.
__bp_last_ret_value="$?"
# Don't invoke precmds if we are inside an execution of an "original
# prompt command" by another precmd execution loop. This avoids infinite
# recursion.
if (( __bp_inside_precmd > 0 )); then
return
fi
local __bp_inside_precmd=1
if (( __bp_time_functions > 0 )) ; then
time __bp_precmd_invoke_cmd_loop
echo "total"
else
__bp_precmd_invoke_cmd_loop
fi
}
# Sets a return value in $?. We may want to get access to the $? variable in our
# precmd functions. This is available for instance in zsh. We can simulate it in bash
# by setting the value here.
__bp_set_ret_value() {
return $1
}
__bp_in_prompt_command() {
local prompt_command_array
IFS=';' read -ra prompt_command_array <<< "$PROMPT_COMMAND"
local trimmed_arg
IFS= read -r trimmed_arg < <(__bp_trim_whitespace "$1")
local command
for command in "${prompt_command_array[@]}"; do
local trimmed_command
IFS= read -r trimmed_command < <(__bp_trim_whitespace "$command")
# Only execute each function if it actually exists.
if [[ "$trimmed_command" == "$trimmed_arg" ]]; then
return 0
fi
done
return 1
}
__bp_preexec_invoke_exec_loop() {
# If none of the previous checks have returned out of this function, then
# the command is in fact interactive and we should invoke the user's
# preexec functions.
# Invoke every function defined in our function array.
local preexec_function
local preexec_function_ret_value
local preexec_ret_value=0
for preexec_function in "${preexec_functions[@]}"; do
# Only execute each function if it actually exists.
# Test existence of function with: declare -[fF]
if type -t "$preexec_function" 1>/dev/null; then
__bp_set_ret_value $__bp_last_ret_value
# Quote our function invocation to prevent issues with IFS
if (( __bp_time_functions > 0 )) ; then
echo "$preexec_function"
time "$preexec_function" "$this_command"
else
"$preexec_function" "$this_command"
fi
preexec_function_ret_value="$?"
if [[ "$preexec_function_ret_value" != 0 ]]; then
preexec_ret_value="$preexec_function_ret_value"
fi
fi
done
# Restore the last argument of the last executed command, and set the return
# value of the DEBUG trap to be the return code of the last preexec function
# to return an error.
# If `extdebug` is enabled a non-zero return value from any preexec function
# will cause the user's command not to execute.
# Run `shopt -s extdebug` to enable
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
}
# This function is installed as the DEBUG trap. It is invoked before each
# interactive prompt display. Its purpose is to inspect the current
# environment to attempt to detect if the current command is being invoked
# interactively, and invoke 'preexec' if so.
__bp_preexec_invoke_exec() {
# Save the contents of $_ so that it can be restored later on.
# https://stackoverflow.com/questions/40944532/bash-preserve-in-a-debug-trap#40944702
__bp_last_argument_prev_command="$1"
# Don't invoke preexecs if we are inside of another preexec.
if (( __bp_inside_preexec > 0 )); then
return
fi
local __bp_inside_preexec=1
# Checks if the file descriptor is not standard out (i.e. '1')
# __bp_delay_install checks if we're in test. Needed for bats to run.
# Prevents preexec from being invoked for functions in PS1
if [[ ! -t 1 && -z "$__bp_delay_install" ]]; then
return
fi
if [[ -n "$COMP_LINE" ]]; then
# We're in the middle of a completer. This obviously can't be
# an interactively issued command.
return
fi
if [[ -z "$__bp_preexec_interactive_mode" ]]; then
# We're doing something related to displaying the prompt. Let the
# prompt set the title instead of me.
return
else
# If we're in a subshell, then the prompt won't be re-displayed to put
# us back into interactive mode, so let's not set the variable back.
# In other words, if you have a subshell like
# (sleep 1; sleep 2)
# You want to see the 'sleep 2' as a set_command_title as well.
if [[ 0 -eq "$BASH_SUBSHELL" ]]; then
__bp_preexec_interactive_mode=""
fi
fi
if __bp_in_prompt_command "$BASH_COMMAND"; then
# If we're executing something inside our prompt_command then we don't
# want to call preexec. Bash prior to 3.1 can't detect this at all :/
__bp_preexec_interactive_mode=""
return
fi
local this_command
local _
IFS=" " read -r _ this_command < <( HISTTIMEFORMAT= builtin history 1 )
# Sanity check to make sure we have something to invoke our function with.
if [[ -z "$this_command" ]]; then
return
fi
if (( __bp_time_functions > 0 )) ; then
time __bp_preexec_invoke_exec_loop
echo "total"
else
__bp_preexec_invoke_exec_loop
fi
}
__bp_install() {
# Exit if we already have this installed.
if [[ "$PROMPT_COMMAND" == *"__bp_precmd_invoke_cmd"* ]]; then
return 1;
fi
trap '__bp_preexec_invoke_exec "$_"' DEBUG
# Preserve any prior DEBUG trap as a preexec function
local prior_trap
IFS= read -r prior_trap < <( sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"$__bp_trap_string" )
unset __bp_trap_string
if [[ -n "$prior_trap" ]]; then
eval '__bp_original_debug_trap() {
'"$prior_trap"'
}'
preexec_functions+=(__bp_original_debug_trap)
fi
# Adjust our HISTCONTROL Variable if needed.
__bp_adjust_histcontrol
# Issue #25. Setting debug trap for subshells causes sessions to exit for
# backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash.
#
# Disabling this by default. It can be enabled by setting this variable.
if [[ -n "$__bp_enable_subshells" ]]; then
# Set so debug trap will work be invoked in subshells.
set -o functrace > /dev/null 2>&1
shopt -s extdebug > /dev/null 2>&1
fi;
# Install our hooks in PROMPT_COMMAND to allow our trap to know when we've
# actually entered something.
PROMPT_COMMAND="__bp_precmd_invoke_cmd; __bp_interactive_mode"
# Add two functions to our arrays for convenience
# of definition.
precmd_functions+=(precmd)
preexec_functions+=(preexec)
# Since this function is invoked via PROMPT_COMMAND, re-execute PC now that it's properly set
eval "$PROMPT_COMMAND"
}
# Sets our trap and __bp_install as part of our PROMPT_COMMAND to install
# after our session has started. This allows bash-preexec to be inlucded
# at any point in our bash profile. Ideally we could set our trap inside
# __bp_install, but if a trap already exists it'll only set locally to
# the function.
__bp_install_after_session_init() {
# Make sure this is bash that's running this and return otherwise.
if [[ -z "$BASH_VERSION" ]]; then
return 1;
fi
# If there's an existing PROMPT_COMMAND capture it and convert it into a function
# So it is preserved and invoked during precmd.
if [[ -n "$PROMPT_COMMAND" ]]; then
eval '__bp_original_prompt_command() {
'"$PROMPT_COMMAND"'
}'
precmd_functions+=(__bp_original_prompt_command)
fi
# Installation is finalized in PROMPT_COMMAND, which allows us to override the DEBUG
# trap. __bp_install sets PROMPT_COMMAND to its final value, so these are only
# invoked once.
# It's necessary to clear any existing DEBUG trap in order to set it from the install function.
# Using \n as it's the most universal delimiter of bash commands
PROMPT_COMMAND=$'\n__bp_trap_string="$(trap -p DEBUG)"\ntrap DEBUG\n__bp_install\n'
}
# Run our install so long as we're not delaying it.
if [[ -z "$__bp_delay_install" ]]; then
__bp_install_after_session_init
fi;

21
.bashrc.d/04-colors.sh Executable file
View file

@ -0,0 +1,21 @@
#! /bin/bash
COLORSOFF='\033[0m'
RED='\033[00;31m'
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
BLUE='\033[00;34m'
PURPLE='\033[00;35m'
CYAN='\033[00;36m'
LIGHTGRAY='\033[00;37m'
LRED='\033[01;31m'
LGREEN='\033[01;32m'
LYELLOW='\033[01;33m'
LBLUE='\033[01;34m'
LPURPLE='\033[01;35m'
LCYAN='\033[01;36m'
WHITE='\033[01;37m'
export CLICOLOR=1

203
.bashrc.d/05-prompt.sh Executable file
View file

@ -0,0 +1,203 @@
#! /bin/bash
__bashrc_prompt_timings=${__bashrc_prompt_timings:-0}
function tmux_set_title {
if [ ! -z "$TMUX" ] ; then
printf '\033]2;%s\033\\' "$1"
fi
}
function middle_truncate {
local max=$(($1))
local mid
local rem
local left
local right
IFS= read -r str
local len=${#str}
if ((len <= max)) ; then
echo -n "$str"
return
fi
if ((max == 1)) ; then
echo -n "${str:0:1}"$'\U00002026'
return
fi
mid=$((len / 2))
rem=$((len - max + 1))
left=$((rem / 2))
right=$((rem - left))
echo "${str:0:$((mid - left))}"$'\U00002026'"${str:$((mid + right))}"
}
function add_preexec_function {
local func="$1"
for each in "${preexec_functions[@]}" ; do
[ "$each" = "$func" ] && return 1
done
preexec_functions+=("$func")
return 0
}
function add_precmd_function {
local func="$1"
for each in "${precmd_functions[@]}" ; do
[ "$each" = "$func" ] && return 1
done
precmd_functions+=("$func")
return 0
}
function seconds_since_epoch {
date '+%s'
}
function __precmd_debug_timings {
PS4='+ $EPOCHREALTIME\011 '
exec 3>&2 2>/tmp/bashstart.$$.log
set -x
}
if ((__bashrc_prompt_timings)) ; then
add_precmd_function __precmd_debug_timings
fi
function __preexec_tmux_title {
local this_command="$1"
local TRUNC_PWD
local TRUNC_CMD
IFS= read -r TRUNC_PWD < <(basename "$PWD")
IFS= read -r TRUNC_PWD < <(middle_truncate 8 <<< "$TRUNC_PWD")
IFS= read -r TRUNC_CMD < <(middle_truncate 12 <<< "$this_command")
tmux_set_title "$TRUNC_PWD - $TRUNC_CMD"
}
add_preexec_function __preexec_tmux_title
function __precmd_ran_once {
PROMPT_COMMAND_ONCE=1
}
add_precmd_function __precmd_ran_once
function __precmd_tmux_title {
local TRUNC_PWD
if [[ "$PWD" == "$HOME" ]] ; then
tmux_set_title ""
else
IFS= read -r TRUNC_PWD < <(basename "$PWD")
IFS= read -r TRUNC_PWD < <(middle_truncate 20 <<< "$TRUNC_PWD")
tmux_set_title "$TRUNC_PWD"
fi
}
add_precmd_function __precmd_tmux_title
PROMPT_HOOKS=()
function git_prompty {
local OUTPUT
local SOMETHING
local UPSTREAM
local FAILURE
local STATUS
local TMP
IFS= read -r -d '' STATUS < <( git status --porcelain 2>/dev/null || echo 'FATAL')
if [[ "$STATUS" =~ ^FATAL ]] ; then
return
fi
IFS= read -r -d '' OUTPUT < <(grep -o '^..' <<< "$STATUS")
echo -n "\[${GREEN}\][ git: "
IFS= read -r UPSTREAM < <(git rev-list --count '@{upstream}..HEAD' 2>/dev/null)
if ((UPSTREAM > 0)) ; then
echo -n "${PURPLE}ahead ${UPSTREAM} ${GREEN}| "
fi
if [[ "$OUTPUT" =~ "M" ]]; then
SOMETHING=1
echo -n "\[${YELLOW}\]~ "
fi
if [[ "$OUTPUT" =~ "R" ]] ; then
SOMETHING=1
echo -n "\[${YELLOW}\]> "
fi
if [[ "$OUTPUT" =~ "D" ]] ; then
SOMETHING=1
echo -n "\[${RED}\]- "
fi
if [[ "$OUTPUT" =~ "A" ]] ; then
SOMETHING=1
echo -n "\[${GREEN}\]+ "
fi
if ((!SOMETHING)) ; then
echo -n "\[${CYAN}\]= "
fi
echo -n "\[${GREEN}\]] ${COLORSOFF}"
}
function __precmd_host_prompt {
local RANDOM_CHARS=(
">"
)
local RANDOM_CHAR="${RANDOM_CHARS[RANDOM % ${#RANDOM_CHARS[@]}]}"
local HOSTY="$(hostname)"
if [ "$(type -t __host_alts)" == "function" ] ; then
__host_alts "$HOSTY"
fi
local NEW_PROMPT='\u@'"$HOSTY"':\w '"$(git_prompty)\n\[${GREEN}\]${PROMPT_CHAR:-$RANDOM_CHAR}\[${COLORSOFF}\] "
for each in "${PROMPT_HOOKS[@]}" ; do
$each "$NEW_PROMPT"
NEW_PROMPT="${PROMPT_HOOK_RESULT:-${NEW_PROMPT}}"
done
export PS1="$NEW_PROMPT"
}
add_precmd_function __precmd_host_prompt
function __precmd_debug_timings_end {
set +x
exec 2>&3 3>&-
}
if ((__bashrc_prompt_timings)) ; then
add_precmd_function __precmd_debug_timings_end
fi
function __main {
local CURDIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
}
__main
unset -f __main

29
.bashrc.d/10-tmux.sh Executable file
View file

@ -0,0 +1,29 @@
#! /bin/bash
function tmux() {
local SOMMELIER=$(which sommelier 2>/dev/null)
if [[ ! -z "$SOMMELIER" ]] ; then
SOMMELIER="$SOMMELIER -X --glamor"
fi
if [[ $# -eq 0 ]] ; then
command $SOMMELIER tmux new-session \; new-window \; new-window \; new-window \; new-window \; new-window
else
command $SOMMELIER tmux "$@"
fi
}
tmxsync () {
export _TMUX_SYNC=1;
for w in $(tmux lsw -F '#{window_index}#{window_active}'|sed -ne 's/0$//p'); do
tmux joinp -d -b -s $w -v -t $(tmux lsp -F '#{pane_index}'|tail -n 1)
done
tmux setw synchronize-panes
}
tmxunsync () {
[ -z "$_TMUX_SYNC" ] && return
for p in $(tmux lsp -F '#{pane_index}#{pane_active}' | sed -ne 's/0$//p'); do
tmux breakp -d -t 1
done
unset _TMUX_SYNC
tmux setw synchronize-panes
}

50
.bashrc.d/20-git.sh Executable file
View file

@ -0,0 +1,50 @@
#! /bin/bash
function git {
if [ "$1" == "push" ] ; then
git log @{upstream}..
fi
local HASHES=
local PULLSTATUS=
if [ "$1" == "pull" ] && [ "$OSTYPE" != "msys" ] ; then
local SCRIPTTMP="$(mktemp)"
local SCRIPTCOMMAND=("script" "--return" "-c" "git $*" "$SCRIPTTMP")
if [ "$(type -t script)" == "file" ] ; then
SCRIPTCOMMAND=("script" "-q" "$SCRIPTTMP" "git" "$@")
fi
"${SCRIPTCOMMAND[@]}"
IFS= read -r HASHES < <(grep -i -o -E '[0-9a-f]+\.\.[0-9a-f]+' "$SCRIPTTMP")
rm "$SCRIPTTMP"
if [ ! -z "$HASHES" ] ; then
git diff "$HASHES"
fi
else
command git "$@"
fi
}
alias gO='git push'
alias gI='git pull'
alias gOoh='git push -u origin HEAD'
alias gC='git commit'
alias gCa='git commit -a'
alias gco='git checkout'
alias gcou='git checkout HEAD^'
alias ga='git add'
alias gad='git add .'
alias gap='git add -p'
alias gs='git stash'
alias gd='git diff'
alias gcob='git checkout -b'
alias gm='git merge'
alias gr='git reset'
alias gR='git reset --hard'
alias grb='git rebase'
alias gl='git log'
alias cdg='cd "$(git rev-parse --show-toplevel)"'
alias hub='git-hub'

16
.bashrc.d/30-fzf.bash Executable file
View file

@ -0,0 +1,16 @@
#! /bin/bash
# Setup fzf
# ---------
if [[ ! "$PATH" == *$HOME/.vim/plugged/fzf/bin* ]]; then
export PATH="$PATH:$HOME/.vim/plugged/fzf/bin"
fi
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "$HOME/.vim/plugged/fzf/shell/completion.bash" 2> /dev/null
# Key bindings
# ------------
source "$HOME/.vim/plugged/fzf/shell/key-bindings.bash"
bind -x '"\C-p":"fzf-file-widget"'

65
.bashrc.d/99-aliases.sh Executable file
View file

@ -0,0 +1,65 @@
#! /bin/bash
# Random aliases without a home
function xo {
if which open &>/dev/null ; then
open "$@"
else
xdg-open "$@"
fi
}
function set_aws_profile {
local PROFILES=$(grep '\[' "$HOME/.aws/credentials" | tr '[]' ' ')
if [ -n "$1" ] ; then
local COUNT=$(($1))
local ACCOUNT
while read ACCOUNT ; do
((COUNT--))
if ((!COUNT)) ; then
break
fi
done < <(echo "$PROFILES")
export AWS_PROFILE="$ACCOUNT"
else
echo "AWS Profiles: "
echo "$PROFILES" | nl
echo "
Syntax: ${FUNCNAME[0]} <PROFILE NUMBER>
"
fi
}
function yarn {
if which yarnpkg &>/dev/null ; then
yarnpkg "$@"
else
command yarn "$@"
fi
}
function vim {
if which nvim &>/dev/null ; then
nvim "$@"
else
command vim "$@"
fi
}
function dotnet {
if which dotnet-sdk.dotnet 2>&1 >/dev/null ; then
dotnet-sdk.dotnet "$@"
else
command dotnet "$@"
fi
}
alias ...='cd ..'
whichrm=$(which grm rm 2>/dev/null | head -1)
function rm {
$whichrm -I "$@"
}

12
.bashrc.d/99-archivebox.sh Executable file
View file

@ -0,0 +1,12 @@
#! /bin/bash
function archivebox {
local ARGS=()
if [ "$1" == "add" ] ; then
shift
ARGS+=("add" "--extract" "singlefile,title,favicon")
fi
ARGS+=("$@")
CHROME_USER_DATA_DIR="$HOME/.config/archivebox/chrome_profile" CHROME_USER_AGENT='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' TIMEOUT=120 command archivebox "${ARGS[@]}"
}

37
.bashrc.d/99-direnv.sh Executable file
View file

@ -0,0 +1,37 @@
#! /bin/bash
direnv() {
if [ "$1" == "allow" ] || [ "$1" == "check" ] ; then
cat "$2/.envrc"
echo
echo -e "${YELLOW}If you really want to allow the above file, use \`direnv really\`${COLORSOFF}"
return
fi
if [ "$1" == "really" ] ; then
shift
command direnv allow "$@"
return
fi
command direnv "$@"
}
__precmd_direnv_hook() {
which direnv 2>&1 >/dev/null || return
IFS= read -r DIRENV < <(direnv export bash)
eval "$DIRENV"
}
__main() {
alias dea='direnv allow'
alias der='direnv really'
local DIRENV
add_precmd_function __precmd_direnv_hook
}
__main
unset -f __main

1
.bashrc.d/99-docker.sh Executable file
View file

@ -0,0 +1 @@
#alias docker="docker.js"

43
.bashrc.d/99-flutter.sh Executable file
View file

@ -0,0 +1,43 @@
function cdf {
local CURDIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
local FILENAMES=()
local GROOT="$(git rev-parse --show-toplevel 2>/dev/null)"
if [[ -z "$GROOT" ]] ; then
echo "Not a git repo!"
fi
# bash on macos will not handle exclamation marks in math expressions correctly!
while read FILENAME ; do
if [[ $(yq -r '.flutter != null' "$FILENAME") != true ]] ; then
continue
fi
if [[ $(yq -r '.flutter != null and .flutter.plugin != null' "$FILENAME") == true ]] ; then
continue
fi
FILENAME="$(readlink -m "$(dirname "$FILENAME")")"
FILENAMES+=("$FILENAME")
done < <( find "$GROOT" -iname 'pubspec.yaml' )
local LAUNCH_JSON="$GROOT/.vscode/launch.json"
if [[ ${#FILENAMES[@]} -gt 0 ]] ; then
while read VSCODEPATH ; do
VSCODEPATH="$(readlink -m "$GROOT/$VSCODEPATH")"
for FILENAME in "${FILENAMES[@]}" ; do
if [[ "$FILENAME" == "$VSCODEPATH" ]] ; then
cd "$FILENAME"
return
fi
done
done < <( dart run "$CURDIR/cdf/bin/cdf.dart" "$LAUNCH_JSON" )
for FILENAME in "${FILENAMES[@]}" ; do
cd "$FILENAME"
return
done
fi
echo 'No matching dart projects!'
}

4
.bashrc.d/99-node.sh Executable file
View file

@ -0,0 +1,4 @@
#! /bin/bash
node_add_debug () {
node ~/.bashrc.d/node-commands.js add_debug
}

8
.bashrc.d/99-overcast.sh Executable file
View file

@ -0,0 +1,8 @@
# Overcast Tab completion
_overcast_completions() {
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=($(compgen -W "`overcast completions`" -- "$cur"))
return 0
}
which overcast 2>&1 >/dev/null && complete -F _overcast_completions overcast

7
.bashrc.d/99-recovery.sh Executable file
View file

@ -0,0 +1,7 @@
#! /bin/bash
mount_chroot () {
sudo mount "$1" "$2" || return $?
for each in dev proc sys run ; do
sudo mount --bind "/$each" "$2/$each"
done
}

16
.bashrc.d/99-windows.sh Executable file
View file

@ -0,0 +1,16 @@
#! /bin/bash
function __main() {
local GARBAGE
# Placeholder for WSL, etc.
}
function docker-machine-env-windows() {
eval $(docker-machine.exe env --shell bash "$@" | sed -e 's@\\@/@g' -e 's@"\([a-zA-Z]\):/@"/mnt/\L\1/@g')
}
function fixcodepage() {
cmd.exe /c "chcp 850 && $* && chcp 65001 || chcp 65001"
}
__main
unset -f __main;

3
.bashrc.d/cdf/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/

View file

@ -0,0 +1,3 @@
## 1.0.0
- Initial version.

2
.bashrc.d/cdf/README.md Normal file
View file

@ -0,0 +1,2 @@
A sample command-line application with an entrypoint in `bin/`, library code
in `lib/`, and example unit test in `test/`.

View file

@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.
include: package:lints/recommended.yaml
# Uncomment the following section to specify additional rules.
# linter:
# rules:
# - camel_case_types
# analyzer:
# exclude:
# - path/to/excluded/files/**
# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints
# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options

View file

@ -0,0 +1,8 @@
import 'package:cdf/cdf.dart' as cdf;
Future<void> main(List<String> arguments) async {
final cwds = await cdf.loadVsCodeTargets(arguments[0]);
for (final cwd in cwds) {
print(cwd);
}
}

View file

@ -0,0 +1,25 @@
import 'dart:io';
import 'package:json5/json5.dart';
Future<List<String>> loadVsCodeTargets(String path) async {
final contents = await File(path).readAsString();
final data = JSON5.parse(contents);
final cfgs = data['configurations'] as List<dynamic>;
final cwds = <String>[];
for (final cfg in cfgs) {
final type = cfg['type'] as String;
if (type != 'dart') {
continue;
}
String? cwd = cfg['cwd'] as String?;
if (cwd == null) {
continue;
}
cwds.add(cwd);
}
return cwds;
}

381
.bashrc.d/cdf/pubspec.lock Normal file
View file

@ -0,0 +1,381 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49"
url: "https://pub.dev"
source: hosted
version: "65.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07
url: "https://pub.dev"
source: hosted
version: "6.3.0"
args:
dependency: transitive
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
url: "https://pub.dev"
source: hosted
version: "2.4.2"
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
collection:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.18.0"
convert:
dependency: transitive
description:
name: convert
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
coverage:
dependency: transitive
description:
name: coverage
sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76"
url: "https://pub.dev"
source: hosted
version: "1.7.2"
crypto:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.3"
file:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
glob:
dependency: transitive
description:
name: glob
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
url: "https://pub.dev"
source: hosted
version: "3.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
io:
dependency: transitive
description:
name: io
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
json5:
dependency: "direct main"
description:
name: json5
sha256: b67d6e06c9e225c8277d3c43f796677af7975a2a2b0669ff12ba38ff466a31f4
url: "https://pub.dev"
source: hosted
version: "0.8.2"
lints:
dependency: "direct dev"
description:
name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
logging:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
matcher:
dependency: transitive
description:
name: matcher
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16+1"
meta:
dependency: transitive
description:
name: meta
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.11.0"
mime:
dependency: transitive
description:
name: mime
sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e
url: "https://pub.dev"
source: hosted
version: "1.0.4"
node_preamble:
dependency: transitive
description:
name: node_preamble
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
url: "https://pub.dev"
source: hosted
version: "2.0.2"
package_config:
dependency: transitive
description:
name: package_config
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
path:
dependency: transitive
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
pool:
dependency: transitive
description:
name: pool
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
url: "https://pub.dev"
source: hosted
version: "1.5.1"
pub_semver:
dependency: transitive
description:
name: pub_semver
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
shelf:
dependency: transitive
description:
name: shelf
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
url: "https://pub.dev"
source: hosted
version: "1.4.1"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
shelf_static:
dependency: transitive
description:
name: shelf_static
sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e
url: "https://pub.dev"
source: hosted
version: "1.1.2"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
source_maps:
dependency: transitive
description:
name: source_maps
sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
url: "https://pub.dev"
source: hosted
version: "0.10.12"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.2"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
test:
dependency: "direct dev"
description:
name: test
sha256: "3d028996109ad5c253674c7f347822fb994a087614d6f353e6039704b4661ff2"
url: "https://pub.dev"
source: hosted
version: "1.25.0"
test_api:
dependency: transitive
description:
name: test_api
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
test_core:
dependency: transitive
description:
name: test_core
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.2"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: a2662fb1f114f4296cf3f5a50786a2d888268d7776cf681aa17d660ffa23b246
url: "https://pub.dev"
source: hosted
version: "14.0.0"
watcher:
dependency: transitive
description:
name: watcher
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
url: "https://pub.dev"
source: hosted
version: "2.4.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
yaml:
dependency: transitive
description:
name: yaml
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.3 <4.0.0"

View file

@ -0,0 +1,16 @@
name: cdf
description: A sample command-line application.
version: 1.0.0
# repository: https://github.com/my_org/my_repo
environment:
sdk: ^3.2.3
# Add regular dependencies here.
dependencies:
json5: ^0.8.2
# path: ^1.8.0
dev_dependencies:
lints: ^2.1.0
test: ^1.24.0

View file

@ -0,0 +1,8 @@
import 'package:cdf/cdf.dart';
import 'package:test/test.dart';
void main() {
test('calculate', () {
expect(calculate(), 42);
});
}

View file

@ -0,0 +1,20 @@
const shell = require('shelljs');
const fs = require('fs').promises;
const scriptName = process.argv[2]
const scripts = {
add_debug: () => {
shell.config.fatal = true;
shell.exec('yarn add nodemon');
const packagePath = process.cwd() + '/package.json';
const package = require(packagePath);
package.scripts = package.scripts || {};
package.scripts.debug = 'nodemon -- --inspect-brk ./index.js';
return Promise.resolve()
.then(() => fs.writeFile(packagePath, JSON.stringify(package, null, 4), 'utf8'));
}
};
scripts[scriptName]()
.catch(e => {
process.exit(1);
});

10
.bashrc.d/package.json Normal file
View file

@ -0,0 +1,10 @@
{
"name": "bashrc",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"dependencies": {
"shelljs": "^0.8.2"
}
}

108
.bashrc.d/yarn.lock Normal file
View file

@ -0,0 +1,108 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
balanced-match@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
glob@^7.0.0:
version "7.1.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
interpret@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614"
integrity sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
dependencies:
wrappy "1"
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
path-parse@^1.0.5:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=
dependencies:
resolve "^1.1.6"
resolve@^1.1.6:
version "1.8.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==
dependencies:
path-parse "^1.0.5"
shelljs@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.2.tgz#345b7df7763f4c2340d584abb532c5f752ca9e35"
integrity sha512-pRXeNrCA2Wd9itwhvLp5LZQvPJ0wU6bcjaTMywHHGX5XWhVN2nzSu7WV0q+oUY7mGK3mgSkDDzP3MgjqdyIgbQ==
dependencies:
glob "^7.0.0"
interpret "^1.0.0"
rechoir "^0.6.2"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=

View file

@ -0,0 +1 @@
/home/empathicqubit/dotfiles/setup/../.config/dark-mode-notify/.DS_Store.bak

Binary file not shown.

View file

@ -0,0 +1 @@
/home/empathicqubit/dotfiles/setup/../.config/dark-mode-notify

View file

@ -0,0 +1,31 @@
property waitKey : 0.001
property waitTransition : 0.25
on run argv
set darkMode to item 1 of argv
set settingsString to item 2 of argv
activate application "Microsoft Teams"
tell application "System Events"
key code 53
delay waitTransition
tell process "Microsoft Teams"
click menu item settingsString of menu "Microsoft Teams" of menu bar 1
end tell
delay waitTransition
keystroke tab
delay waitKey
if darkMode is "1" then
key code 124 # right arrow
delay waitKey
end if
keystroke return
delay waitKey
key code 53
delay waitTransition
keystroke tab using command down
end tell
end run

View file

@ -0,0 +1,17 @@
#! /bin/bash
export PATH="$PATH:/opt/homebrew/bin"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
jq -r '..|.language? | select(.)' storage.json | head -1
TEAMS_PATH="$(dirname "$(ps -x -o command | grep Contents/MacOS/Teams | grep -v grep)")"
if [ -z "$TEAMS_PATH" ] ; then
exit 0;
fi
STORAGE_FILE="$HOME/Library/Application Support/Microsoft/Teams/storage.json"
TEAMS_LOCALE="$(jq -r '..|.language? | select(.)' "$STORAGE_FILE" | head -1)"
LOCALE_FILE="$TEAMS_PATH/../Resources/locales/locale-$TEAMS_LOCALE.json"
SETTINGS_STRING="$(jq -r .strings.usertask_settings "$LOCALE_FILE")"
osascript "$SCRIPT_DIR/daynight.applescript" "$DARKMODE" "$SETTINGS_STRING"

View file

@ -0,0 +1,458 @@
[
{
"border": "normal",
"floating": "auto_off",
"layout": "splith",
"percent": 1,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.25,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 106,
"x": 0,
"y": 0
},
"name": " - Terminal",
"percent": 0.333333333333333,
"swallows": [
{
"title": "[Tt]erminal"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 114,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.333333333333333,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 122,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [null core]",
"percent": 0.333333333333333,
"swallows": [
{
"class": "^Lsnes$",
"title": "null "
}
],
"type": "con"
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 1914,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 634,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.25,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 954,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 474,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 378,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 234,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.25,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 314,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 208,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 269,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 154,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.25,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 186,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 132,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 168,
"x": 0,
"y": 0
},
"name": "lsnes rr2-β24 [bsnes v085 (Compatibility core)]",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Compatibility"
}
],
"type": "con"
},
{
"border": "normal",
"current_border_width": 3,
"floating": "auto_off",
"geometry": {
"height": 1030,
"width": 141,
"x": 0,
"y": 0
},
"name": "lsnes: Messages",
"percent": 0.5,
"swallows": [
{
"class": "^Lsnes$",
"title": "Messages"
}
],
"type": "con"
}
]
}
]
}
]
}
]

1
.config/i3/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
local.sh

247
.config/i3/config Normal file
View file

@ -0,0 +1,247 @@
# vim: syntax=i3config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
no_focus [class=".*"]
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# Window colors
for_window [class="Firefox"] title_format "<span background='#eda302'>%title</span>"
for_window [class="(?i)office"] title_format "<span background='#111166'>%title</span>"
for_window [class="Code"] title_format "<span background='#111166'>%title</span>"
for_window [class="keepassxc"] title_format "<span background='#009900'>%title</span>"
for_window [class="Firefox" floating] sticky enable
# Misc window rules
exec --no-startup-id "~/.vim/plugged/i3-battery-popup/i3-battery-popup -n"
for_window [title="Battery Warning"] sticky enable
bindsym $mod+semicolon exec xfce4-screensaver-command --activate
# Cannabilize some xfce services
exec --no-startup-id xfsettingsd
exec --no-startup-id xfce4-screensaver
bindsym $mod+Shift+e exec code ~/.config/i3
bindsym $mod+Escape exec ~/.config/i3/nerd-dictation.sh begin
bindsym $mod+Shift+Escape exec ~/.config/i3/nerd-dictation.sh end
bindsym Print exec xfce4-screenshooter
exec_always --no-startup-id "~/.config/i3/wallpaper.sh"
# Local modifications that won't work with every computer
exec "~/.config/i3/local.sh"
exec --no-startup-id "gxkb"
exec --no-startup-id "fcitx -d"
exec --no-startup-id "xbattbar -c"
bindsym $mod+m exec --no-startup-id "~/.vim/plugged/i3-layout-manager/layout_manager.sh"
bindsym $mod+d exec --no-startup-id "i3-dmenu-desktop"
exec_always --no-startup-id exec i3-workspace-names-daemon
exec dex -ae i3
bindsym $mod+F1 exec "cat ~/.config/i3/config | zenity --text-info --filename=/dev/stdin"
bindsym $mod+F2 exec setxkbmap us -variant dvorak-intl
bindsym $mod+F3 exec setxkbmap us
bindsym $mod+F4 exec setxkbmap de -variant neo
bindsym $mod+F7 exec --no-startup-id "~/.config/i3/screen-switcher.sh"
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Playback controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPause exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
#Brightness
bindsym XF86MonBrightnessUp exec --no-startup-id bash -c 'b=$(xrandr --verbose | grep -i brightness | head -n 1 | cut -d" " -f2) && b2=$(echo -e "import math\nf = lambda x: (1 - 1/(1+math.exp(4*x-2)))\nprint(\\\"%.2f\\\" % f(0.1+$b))" | python) && xrandr --output DP-4 --brightness $b2'
bindsym XF86MonBrightnessDown exec --no-startup-id bash -c 'b=$(xrandr --verbose | grep -i brightness | head -n 1 | cut -d" " -f2) && b2=$(echo -e "import math\nf = lambda x: (1 - 1/(1+math.exp(4*x-2)))\nprint(\\\"%.2f\\\" % f(-0.1+$b))" | python) && xrandr --output DP-4 --brightness $b2'
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+q kill
# start dmenu (a program launcher)
bindsym $mod+space exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+v split h
# split in vertical orientation
bindsym $mod+s split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+minus layout stacking
bindsym $mod+Tab layout tabbed
bindsym $mod+backslash layout toggle split
bindsym $mod+t sticky toggle
# toggle tiling / floating
bindsym $mod+Shift+f floating toggle
bindsym $mod+bracketright move scratchpad
bindsym $mod+Shift+bracketright [workspace=__focused__] move scratchpad
bindsym $mod+bracketleft scratchpad show
bindsym $mod+Shift+bracketleft floating toggle
# change focus between tiling / floating windows
bindsym $mod+plus focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# Reset all window positions to root
bindsym $mod+p [tiling workspace="__focused__"] move workspace "__reorder__"; [workspace="__reorder__"] move workspace current
# reload the configuration file
bindsym $mod+Shift+r reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+p restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+q exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+p mode "default"
}
bindsym $mod+r mode "resize"
## Start i3bar to display a workspace bar (plus the system information i3status
## finds out, if available)
#bar {
# position top
# tray_output primary
# status_command i3status --config ~/.config/i3/i3status.conf
#}
exec --no-startup-id "xfce4-panel --disable-wm-check"

62
.config/i3/i3status.conf Normal file
View file

@ -0,0 +1,62 @@
general {
colors = true
interval = 5
}
order += "disk /"
order += "disk /home"
order += "memory"
order += "cpu_usage"
order += "load"
order += "wireless _first_"
order += "ethernet _first_"
order += "tztime local"
order += "battery all"
cpu_usage {
format= "CPU %usage"
max_threshold= 75
}
wireless _first_ {
format_up = "W (%bitrate) %ip"
format_down = ""
}
ethernet _first_ {
format_up = "E %ip (%speed)"
format_down = ""
}
battery all {
format = "%status %emptytime"
format_down = ""
status_chr = "🔌"
status_bat = "🔋"
status_unk = "UNK"
status_full = "🔋💯"
path = "/sys/class/power_supply/BAT%d/uevent"
low_threshold = 10
}
tztime local {
format = "%Y-%m-%d %H:%M"
}
load {
format = "🏋️ %1min %5min %15min"
}
memory {
format = "🧠 %percentage_used"
threshold_degraded = "10%"
format_degraded = "MEMORY: %free"
}
disk "/" {
format = "💾 %percentage_used"
}
disk "/home" {
format = "🏠 %percentage_used"
}

View file

49
.config/i3/wallpaper-reddit.sh Executable file
View file

@ -0,0 +1,49 @@
#!/bin/bash
# date: 2018-06-26
# version: 2.3
# author: xereeto
# licence: wtfpl
tries=0
trap "exit 1" TERM
export TOP_PID=$$
CACHE_FOLDER="$HOME/.cache/xereeto-wallpaper"
CONFIG_FOLDER="$HOME/.config/xereeto-wallpaper"
[[ -z $DISPLAY ]] && export DISPLAY=:0
[[ -d "$CACHE_FOLDER" ]] || mkdir -p "$CACHE_FOLDER"
[[ -d "$CONFIG_FOLDER" ]] || mkdir -p "$CONFIG_FOLDER"
[[ -f "$CONFIG_FOLDER/subreddits" ]] || echo -e "wallpapers\nwallpaper\nearthporn\nspaceporn" > "$CONFIG_FOLDER/subreddits"
addJpegIfImgur(){
while read url; do
isImgur=$(echo "$url" | grep imgur);
url=$(echo $url | sed -e 's/"url": "//' -e 's/",//' -e 's/gallery\///')
[[ -z "$isImgur" ]] && echo $url || echo $url | sed -e 's/$/\.jpg/'
done
}
startOver(){
getWallpaper "shitsfucked"
}
wallargs=()
getWallpaper(){
local time=`date +%s-%N`
local this_wallpaper="$CACHE_FOLDER/$time.jpg"
if [[ $tries > 10 ]]; then echo "too many failed attempts, exiting"; kill -s TERM $TOP_PID; fi
tries=$((tries+1))
[[ -z "$1" ]] || echo "that didn't work, let's try again"
echo "getting wallpaper..."
curl -s -A "/u/xereeto's wallpaper bot" https://www.reddit.com/r/`grep -v "#" "$CONFIG_FOLDER/subreddits" | shuf -n 1`/.json | jq -r '.data.children[] | .data.url' | addJpegIfImgur | shuf -n 1 - | xargs wget --quiet -O "$this_wallpaper" 2>/dev/null
return
width=$(identify -format %w "$this_wallpaper") 2>/dev/null
height=$(identify -format %h "$this_wallpaper") 2>/dev/null
[[ "$width" -ge 1920 && "$height" -ge 1050 ]] || startOver
wallargs+=("--bg-fill" "$this_wallpaper")
tries=0
}
NUMACTIVE=$(xrandr --listactivemonitors | head -1 | awk '{print $NF}')
for (( i=0; i<NUMACTIVE; i++)) ; do
getWallpaper
sleep 10
done
feh "${wallargs[@]}" # 2>/dev/null || startOver
echo "hope you like your new wp"

15
.config/i3/wallpaper.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
WALLPAPERDIR="$HOME/Bilder/Wallpapers"
NUMACTIVE=$(xrandr --listactivemonitors | head -1 | awk '{print $NF}')
mkdir -p "$WALLPAPERDIR"
wallargs=()
while read FILENAME ; do
echo "$FILENAME"
wallargs+=("--bg-fill" "$FILENAME")
echo "${wallargs[@]}"
done < <( find "$WALLPAPERDIR" -type f | shuf -n "$NUMACTIVE" - )
if [[ "${#wallargs[@]}" -eq 0 ]] ; then
exit 1
fi
echo feh "${wallargs[@]}"
feh "${wallargs[@]}"

2
.config/pip/pip.conf Normal file
View file

@ -0,0 +1,2 @@
[global]
break-system-packages = true

View file

@ -0,0 +1,58 @@
; xfce4-terminal GtkAccelMap rc-file -*- scheme -*-
; this file is an automated accelerator map dump
;
(gtk_accel_path "<Actions>/terminal-window/goto-tab-2" "<Alt>2")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-9" "<Alt>9")
; (gtk_accel_path "<Actions>/terminal-window/copy-input" "")
; (gtk_accel_path "<Actions>/terminal-window/close-other-tabs" "")
; (gtk_accel_path "<Actions>/terminal-window/move-tab-right" "<Primary><Shift>Page_Down")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-7" "<Alt>7")
; (gtk_accel_path "<Actions>/terminal-window/set-title-color" "")
; (gtk_accel_path "<Actions>/terminal-window/edit-menu" "")
; (gtk_accel_path "<Actions>/terminal-window/zoom-menu" "")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-1" "<Alt>1")
; (gtk_accel_path "<Actions>/terminal-window/fullscreen" "F11")
; (gtk_accel_path "<Actions>/terminal-window/read-only" "")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-5" "<Alt>5")
; (gtk_accel_path "<Actions>/terminal-window/preferences" "")
; (gtk_accel_path "<Actions>/terminal-window/reset-and-clear" "")
; (gtk_accel_path "<Actions>/terminal-window/about" "")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-4" "<Alt>4")
; (gtk_accel_path "<Actions>/terminal-window/close-window" "<Primary><Shift>q")
; (gtk_accel_path "<Actions>/terminal-window/reset" "")
; (gtk_accel_path "<Actions>/terminal-window/save-contents" "")
(gtk_accel_path "<Actions>/terminal-window/toggle-menubar" "F10")
; (gtk_accel_path "<Actions>/terminal-window/copy" "<Primary><Shift>c")
; (gtk_accel_path "<Actions>/terminal-window/copy-html" "")
; (gtk_accel_path "<Actions>/terminal-window/last-active-tab" "")
; (gtk_accel_path "<Actions>/terminal-window/show-borders" "")
; (gtk_accel_path "<Actions>/terminal-window/view-menu" "")
; (gtk_accel_path "<Actions>/terminal-window/detach-tab" "<Primary><Shift>d")
; (gtk_accel_path "<Actions>/terminal-window/scroll-on-output" "")
; (gtk_accel_path "<Actions>/terminal-window/show-toolbar" "")
; (gtk_accel_path "<Actions>/terminal-window/next-tab" "<Primary>Page_Down")
; (gtk_accel_path "<Actions>/terminal-window/tabs-menu" "")
; (gtk_accel_path "<Actions>/terminal-window/search-next" "")
; (gtk_accel_path "<Actions>/terminal-window/search-prev" "")
; (gtk_accel_path "<Actions>/terminal-window/undo-close-tab" "")
; (gtk_accel_path "<Actions>/terminal-window/set-title" "<Primary><Shift>s")
; (gtk_accel_path "<Actions>/terminal-window/contents" "F1")
; (gtk_accel_path "<Actions>/terminal-window/zoom-reset" "<Primary>0")
; (gtk_accel_path "<Actions>/terminal-window/close-tab" "<Primary><Shift>w")
; (gtk_accel_path "<Actions>/terminal-window/new-tab" "<Primary><Shift>t")
; (gtk_accel_path "<Actions>/terminal-window/new-window" "<Primary><Shift>n")
; (gtk_accel_path "<Actions>/terminal-window/terminal-menu" "")
; (gtk_accel_path "<Actions>/terminal-window/show-menubar" "")
; (gtk_accel_path "<Actions>/terminal-window/select-all" "<Primary><Shift>a")
; (gtk_accel_path "<Actions>/terminal-window/paste" "<Primary><Shift>v")
; (gtk_accel_path "<Actions>/terminal-window/move-tab-left" "<Primary><Shift>Page_Up")
; (gtk_accel_path "<Actions>/terminal-window/search" "<Primary><Shift>f")
; (gtk_accel_path "<Actions>/terminal-window/file-menu" "")
; (gtk_accel_path "<Actions>/terminal-window/prev-tab" "<Primary>Page_Up")
; (gtk_accel_path "<Actions>/terminal-window/paste-selection" "")
; (gtk_accel_path "<Actions>/terminal-window/zoom-in" "<Primary>plus")
; (gtk_accel_path "<Actions>/terminal-window/zoom-out" "<Primary>minus")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-8" "<Alt>8")
; (gtk_accel_path "<Actions>/terminal-window/help-menu" "")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-3" "<Alt>3")
(gtk_accel_path "<Actions>/terminal-window/goto-tab-6" "<Alt>6")

42
.gitconfig Normal file
View file

@ -0,0 +1,42 @@
[user]
name=empathicqubit
email=empathicqubit@entan.gl
[diff "bin"]
textconv = xxd
[diff]
colorMoved=zebra
[core]
autoclrf=input
trustctime=false
[mergetool.fugitive]
cmd=vim -f -c Gvdiff "$MERGED"
[mergetool.kdiff3]
path="C:/Program Files/KDiff3/kdiff3.exe"
trustExitCode=false
[mergetool "vscode"]
cmd = code --wait $MERGED
[merge]
renamelimit=24000
tool=fugitive
[branch]
autosetuprebase=always
[bash]
enableGitStatus = true
enableStatusSymbol = true
[push]
default = simple
[alias]
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
branches = !"git for-each-ref --sort='-authordate:iso8601' --format=' %(authordate:relative)%09%(refname:short)' refs/heads | less"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
[init]
defaultBranch = main

71
.gitignore vendored Normal file
View file

@ -0,0 +1,71 @@
*
# Includes must go first!
# Folders
!/.bashrc.d/
!/.bashrc.d/**
!/.config/
!/.config/i3/
!/.config/i3/**
!/.config/pip/
!/.config/pip/**
!/.config/i3-layout-manager/
!/.config/i3-layout-manager/**
!/.config/dark-mode-notify*/
!/.config/dark-mode-notify*/**
!/.config/xfce4/
!/.config/xfce4/**
!/.tmux/
!/.tmux/*
!/.tmux/plugins/tpm/**
!/.vim/
!/.vim/**
!/script/
!/script/**
!/setup/
!/setup/**
# Files
!/.bash_aliases
!/.bash_logout
!/.gitconfig
!/.ideavimrc
!/.inputrc
!/.nvim
!/.nvimrc
!/.tern-project
!/.tmux.config
!/.vimrc
!/.vsvimrc
!/.Xmodmap
!/yarn.lock
!/.gitignore
# Then the generic excludes after
*.s[^c]?
node_modules/
.netrwhist
.bashrc.local.d/
.vim/plugged
*.log
*.orig
*.rej
.layout_backup.txt
all-layouts.json

1
.ideavimrc Normal file
View file

@ -0,0 +1 @@
imap jj <ESC>

5
.inputrc Normal file
View file

@ -0,0 +1,5 @@
set editing-mode vi
set keymap vi-insert
"jj": vi-movement-mode

1
.nvim Symbolic link
View file

@ -0,0 +1 @@
.vim

1
.nvimrc Symbolic link
View file

@ -0,0 +1 @@
.vimrc

5
.tern-project Normal file
View file

@ -0,0 +1,5 @@
{
"plugins": {
"node": {}
}
}

2503
.vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load diff

1
.vim/init.vim Symbolic link
View file

@ -0,0 +1 @@
../.vimrc

211
.vimrc Normal file
View file

@ -0,0 +1,211 @@
call plug#begin('~/.vim/plugged')
Plug 'arl/tmux-gitbar'
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
Plug 'junegunn/fzf', { 'do': './install --bin' }
Plug 'empathicqubit/fzf.vim'
Plug 'bouk/dark-mode-notify', { 'branch': 'next' }
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
"Plug 'empathicqubit/vim-document-currentpath', { 'do': 'yarn install' }
Plug 'qpkorr/vim-renamer'
Plug 'chrisbra/Colorizer'
Plug 'maxbane/vim-asm_ca65'
Plug 'lambdalisue/suda.vim'
Plug 'leafgarland/typescript-vim'
Plug 'tikhomirov/vim-glsl'
"Plug 'mhartington/nvim-typescript', {'do': 'npm install -g neovim && ./install.sh'}
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern tern-chrome-extension' }
Plug 'editorconfig/editorconfig-vim'
Plug 'hashivim/vim-terraform'
Plug 'vim-syntastic/syntastic'
Plug 'juliosueiras/vim-terraform-completion'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'isRuslan/vim-es6'
Plug 'junegunn/rainbow_parentheses.vim'
Plug 'mzlogin/vim-smali'
"Plug 'derekwyatt/vim-scala'
Plug 'pearofducks/ansible-vim'
Plug 'puremourning/vimspector'
" NOT ACTUALLY VIM PLUGINS
" ========================
Plug 'ofavre/vimcat', { 'do': 'make -j$(nproc)' }
Plug 'empathicqubit/i3-layout-manager'
Plug 'rjekker/i3-battery-popup'
Plug 'ideasman42/nerd-dictation', { 'branch': 'main' }
" ========================
" END OF NON-VIM PLUGINS
call plug#end()
let g:vimspector_base_dir=$HOME.'/.vim/plugged/vimspector'
let g:javascript_plugin_jsdoc = 1
let g:document_currentpath_path = ''
let g:airline_section_b = '%{g:document_currentpath_path}'
let g:syntastic_terraform_tffilter_plan = 1
let g:syntastic_mode_map = {
\ "mode": "active",
\ "passive_filetypes": ["scala"] }
let g:rainbow#pairs = [['(', ')'], ['<', '>'], ['{', '}'], ['[', ']']]
let g:LanguageClient_serverCommands = { 'haskell': ['hie-wrapper'] }
let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml']
function! _GitDiffWindowSetup() abort
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
.!git diff -b && git diff --staged -b
setlocal filetype=diff
endfunction
function! GitDiffWindow() abort
vert new +call\ _GitDiffWindowSetup()
wincmd J
wincmd p
resize 10
endfunction
autocmd BufRead */.git/COMMIT_EDITMSG call GitDiffWindow()
if has('win32')
let g:python3_host_prog = 'C:/Python36/python.exe'
set guifont=Liberation_Mono:h10:cANSI:qDRAFT
endif
let g:deoplete#enable_at_startup = 1
let g:deoplete#omni_patterns = {}
let g:deoplete#omni_patterns.terraform = '[^ *\t"{=$]\w*'
let g:deoplete#omni#input_patterns.scala='[^. *\t]\.\w*'
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='simple'
let g:tern#is_show_argument_hints_enabled = 1
" Tabs
set shiftwidth=4 expandtab tabstop=8 softtabstop=4 smartindent
if has('win32')
set bs=2
else
set backspace=indent,eol,start
endif
set showcmd hlsearch
command W :w suda://%
set hidden
if has('win32')
silent exec "!mkdir $HOME/.vimswap"
else
silent exec "!mkdir $HOME/.vimswap 2>/dev/null"
endif
set directory=$HOME/.vimswap//
set modeline
set secure
set autoread
set number
set laststatus=2
set encoding=utf8
if(!has('win32') || ( has('win32') && has('gui_running') ))
set background=dark
colorscheme palenight
let g:palenight_terminal_italics=1
endif
let mapleader=","
map <Leader>dl :call vimspector#Launch()<CR>
map <Leader>dn :call vimspector#StepOver()<CR>
map <Leader>dc :call vimspector#Continue()<CR>
map <Leader>di :call vimspector#StepInto()<CR>
map <Leader>do :call vimspector#StepOut()<CR>
map <Leader>dr :VimspectorReset<CR>
map <Leader>ds :call vimspector#Stop()<CR>
map <Leader>dp :call vimspector#Pause()<CR>
map <Leader>db :call vimspector#ToggleBreakpoint()<CR>
map <Leader>cz :ColorHighlight<CR>
map <Leader>ev :e $HOME/.vimrc<CR>
map <Leader>rv :source $HOME/.vimrc<CR>
map <Leader>pi :PlugInstall<CR>
map <Leader>pt :set paste!<CR>
map <Leader>ag :Ag<CR>
map <Leader>_ f_x~<CR>
noremap <C-p> :GFiles<CR>
imap jj <ESC>
imap hh <ESC>
inoremap <expr><tab> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><s-tab> pumvisible() ? "\<C-p>" : "\<TAB>"
autocmd BufRead * RainbowParentheses
autocmd BufWritePost *.scala silent :EnTypeCheck
nnoremap <Leader>t :EnType<CR>
" https://vim.fandom.com/wiki/Different_syntax_highlighting_within_regions_of_a_file
function! TextEnableCodeSnip(filetype,start,end,textSnipHl) abort
let ft=toupper(a:filetype)
let group='textGroup'.ft
if exists('b:current_syntax')
let s:current_syntax=b:current_syntax
" Remove current syntax definition, as some syntax files (e.g. cpp.vim)
" do nothing if b:current_syntax is defined.
unlet b:current_syntax
endif
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
try
execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim'
catch
endtry
if exists('s:current_syntax')
let b:current_syntax=s:current_syntax
else
unlet b:current_syntax
endif
execute 'syntax region textSnip'.ft.'
\ matchgroup='.a:textSnipHl.'
\ keepend
\ start="'.a:start.'" end="'.a:end.'"
\ contains=@'.group
endfunction
call TextEnableCodeSnip( 'javascript', '# BEGIN JS', '# END JS', 'SpecialComment')

3
.vsvimrc Normal file
View file

@ -0,0 +1,3 @@
inoremap jj <ESC>
inoremap kk <ESC>
inoremap hh <ESC>

13
script/.eslintrc.js Normal file
View file

@ -0,0 +1,13 @@
module.exports =
{
"env": {
"node": true,
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
},
"rules": {
"no-undef": "error"
}
};

42
script/attrnorm Executable file
View file

@ -0,0 +1,42 @@
#! /bin/bash
## file: app/appointment-messenger/node_modules/lodash/fp/pullAllBy.js
#USER jessica rw-
#GROUP jessica rw-
#other r--
FILE_REGEX="^#[[:space:]]+file:[[:space:]]+(.*)$"
PERMS_REGEX="USER[[:space:]]+([[:alnum:]]+)[[:space:]]+(([r\-])([w\-])([x\-]))([[:space:]]+(([r\-])([w\-])([x\-])))?"
FILE_UNUSED=0
getfacl -p -R -t "$1" | while read LINE ; do
if [[ "$LINE" =~ $FILE_REGEX ]] ; then
FILENAME="${BASH_REMATCH[1]}"
FILE_UNUSED=1
fi
if [[ "$LINE" =~ $PERMS_REGEX ]] ; then
PERMS="$LINE"
PERMS_READ="${BASH_REMATCH[3]}"
PERMS_WRITE="${BASH_REMATCH[4]}"
PERMS_EXEC="${BASH_REMATCH[5]}"
ACTUAL="${BASH_REMATCH[2]}"
DEFAULTS="${BASH_REMATCH[7]}"
ACTUAL_OTHER="${ACTUAL//[w]/-}"
if ((FILE_UNUSED)) ; then
setfacl -m "group::$ACTUAL" "$FILENAME"
setfacl -m "other::$ACTUAL_OTHER" "$FILENAME"
if [[ ! -z "$DEFAULTS" ]] ; then
DEFAULTS_OTHER="${DEFAULTS//[w]/-}"
setfacl -d -m "group::$DEFAULTS" "$FILENAME"
setfacl -d -m "other::$DEFAULTS_OTHER" "$FILENAME"
fi
fi
fi
done

4
script/attrsec Executable file
View file

@ -0,0 +1,4 @@
#! /bin/bash
setfacl -R -d -m group::--- "$1"
setfacl -R -d -m other::--- "$1"
chmod -R go-rwx "$1"

3
script/cmus-hook Executable file
View file

@ -0,0 +1,3 @@
#! /bin/sh
cmus_notify "$*" &

32
script/dev-node.sh Executable file
View file

@ -0,0 +1,32 @@
#! /bin/bash
VENDOR_ID="$(echo "$1" | awk '-F:' '{ print $1 }')"
PRODUCT_ID="$(echo "$1" | awk '-F:' '{ print $2 }')"
if [ -z "$VENDOR_ID" ] || [ -z "$PRODUCT_ID" ] ; then
>&2 echo "You must specify a device identifier in the format xxxx:yyyy"
exit 1
fi
echo "Nodes for $VENDOR_ID:$PRODUCT_ID"
find /sys/devices -name uevent | {
readarray -t uevents
for u in "${uevents[@]}"; do
path="${u%/uevent}"
while [ "$path" != "/sys/devices" ] && ! [ -f "$path"/idVendor ]; do
path="${path%/*}"
done
[ "$path" != "/sys/devices" ] && read readValue < "$path"/idVendor && [ "$readValue" = "$VENDOR_ID" ] && {
if [ -n "$idProduct" ]; then
read readValue < "$path"/idProduct && [ "$readValue" = "$PRODUCT_ID" ]
fi
} && echo "$u"
done
} | {
readarray -t uevents
[ ${#uevents[@]} -gt 0 ] && sed -n 's,DEVNAME=\(.*\),/dev/\1,p' "${uevents[@]}"
}

167
script/docker.js Executable file
View file

@ -0,0 +1,167 @@
#! /usr/bin/env node
const promisify = require('util').promisify;
const childProcess = require('child_process');
const execFile = promisify(childProcess.execFile);
const spawn = require('child_pty').spawn;
let pullStarted = false;
let pullEnded = false;
const oldTitlePromise =
execFile('tmux', ['display', '-pt', '?', '#{pane_title}'], {
windowsHide: true,
}).catch(() => ({ stdout: '', stderr: '' }));
const whale = '\u{1f433}';
const setTitle = async (title) => {
const oldTitle = await oldTitlePromise;
const pre = oldTitle.stdout.split(whale)[0];
let newTitle = oldTitle.stdout;
if(title) {
newTitle = pre + whale + title;
}
process.stdout.write('\x1b]2;' + newTitle + '\x1b\\');
};
const progress = {};
let lastHash = '';
let averageTotal = 0;
const handle = async (data) => {
const strData = data.toString();
process.stdout.write(strData.replace(/\r\n?/g, '\n'));
if(pullStarted && pullEnded) {
return;
}
for(const line of strData.split(/[\r\n]+/g)) {
if(!pullStarted) {
if (!/^.*:\s*Pulling\s+from\s+\S+\s*$/i.test(line)) {
continue;
}
pullStarted = true;
setTitle('pull');
continue;
}
else if(!pullEnded) {
if(/^\s*Status:\s+Downloaded\s+newer\s+image\s+for/i.test(line)) {
pullEnded = true;
setTitle('pulled');
setTitle();
break;
}
}
let match;
if(match = /([0-9a-f]+):/ig.exec(line)) {
lastHash = match[1] || lastHash;
}
if(!lastHash) {
continue;
}
if(match = /(Pull\s+complete|Already\s+exists|Pulling\s+fs\s+layer|Downloading\s+\[([=>\s]+)\]\s+([0-9\.]+)\w+\/([0-9\.]+)\w+)/ig.exec(line)) {
const eventType = match[1];
const bar = match[2];
const unit = match[3];
const total = match[4];
if(eventType == 'Already exists' || eventType == 'Pull complete') {
const oldHash = progress[lastHash] || {};
progress[lastHash] = {
unit: oldHash.total,
total: oldHash.total,
}
}
else if(eventType == 'Pulling fs layer') {
progress[lastHash] = {
unit: 0,
total: averageTotal,
}
}
else if(bar && unit && total) {
progress[lastHash] = {
unit: parseFloat(unit),
total: parseFloat(total),
};
}
let units = 0;
let totals = 0;
for(const p in progress) {
const item = progress[p];
units += item.unit;
totals += item.total;
}
debugger;
averageTotal = totals / Object.keys(progress).length;
setTitle(((units / totals).toFixed(2) * 100) + '%');
}
}
};
let args = [...process.argv];
const debug = args.includes('--debug');
const main = async() => {
args.shift();
args.shift();
if(debug) {
args.shift();
try {
await execFile('docker', ['rmi', args[0]], {
windowsHide: true,
});
}
catch(e) {
console.error(e);
// Image already gone?
}
args = ['run', '-it', '--rm', ...args];
}
const commandName = args.filter(x => x && !x.startsWith("-"));
/* Output sample for pull
alpine: Pulling from library/node
6c40cc604d8e: Already exists
bf8900ab0b62: Downloading [=> ] 440kB/21.57MB
287f798ae2cd: Downloading [===============> ] 423.6kB/1.332MB
*/
const docker = spawn('docker', args, {
columns: 200,
rows: 1,
name: 'xterm',
cwd: process.cwd(),
});
!debug && process.stdin.setRawMode(true);
process.stdin.pipe(docker.stdin);
docker.stdout.on('data', data => handle(data).catch(e => debug && console.error(e)));
docker.on('close', () => process.exit(0));
};
main()
.then(() => {})
.catch(e => {
debug && console.error(e);
process.exit(1);
});

225
script/flickr-wallpaper.py Executable file
View file

@ -0,0 +1,225 @@
#!/usr/bin/env python3
"""Usage: python flickr-wallpaper.py CONFIG_PATH
ARGUMENTS:
-c or --config : path to config file ('./config')
Config File must have the following format:
groups = Comma-separated list of Flickr Group IDs (ex. 796617@N22)
image_root = PATH to where downloaded files should go (ex. ~/wallpapers)
api_key = API KEY from Flickr
"""
import sys
import urllib.request, urllib.parse, urllib.error
import hashlib
import os
import string
from urllib.parse import urlencode
from urllib.request import urlopen
from xml.dom import minidom
from pprint import pprint
from configobj import ConfigObj
from time import time
from datetime import datetime
HOST = 'http://flickr.com'
API = '/services/rest'
AUTH = False
debug = False
CONFIG_FILENAME = ''
API_KEY = ''
def main(*argv):
from getopt import getopt, GetoptError
global API_KEY
global CONFIG_FILENAME
try:
(opts, args) = getopt(argv[1:],\
'c:',\
['config'])
except GetoptError as e:
print(e)
print(__doc__)
return 1
for o, a in opts:
if o in ('-c' , '--config'):
CONFIG_FILENAME = a
else:
print("Unknown argument: %s" % o)
print(__doc__)
return 1
if (CONFIG_FILENAME == ''):
CONFIG_FILENAME = '~/.flickr-wallpaper-config'
CONFIG_FILENAME = os.path.expandvars(CONFIG_FILENAME)
CONFIG_FILENAME = os.path.expanduser(CONFIG_FILENAME)
print('Using Config file: %s' % CONFIG_FILENAME)
API_KEY = get_api_key()
if (API_KEY == ''):
print("Missing API KEY, must have a line in config file for Flickr API Key, ex. api_key = dddddddd")
print(__doc__)
return 1
image_root = get_image_root()
if (image_root == ''):
print("Missing image_root, must have a line in config file for image root, ex. image_root = /path/to/download")
print(__doc__)
return 1
if not os.path.exists(image_root):
print('Image root path not found, creating path: ' + image_root)
os.makedirs(image_root)
for groupid in get_groups():
min_upload_date = get_min_upload_date(groupid)
download_photos_from_group(image_root, groupid, min_upload_date)
set_min_upload_date(groupid);
def photos_search(user_id='', auth=False, tags='', tag_mode='', text='',\
min_upload_date='', max_upload_date='',\
min_taken_date='', max_taken_date='', \
license='', per_page='', page='', sort='',\
safe_search='', content_type='',
extras='', group_id=''):
"""Returns a list of Photo objects.
If auth=True then will auth the user. Can see private etc
"""
method = 'flickr.photos.search'
data = _doget(method, auth=auth, user_id=user_id, tags=tags, text=text,\
min_upload_date=min_upload_date,\
max_upload_date=max_upload_date, \
min_taken_date=min_taken_date, \
max_taken_date=max_taken_date, \
license=license, per_page=per_page,\
page=page, sort=sort, safe_search=safe_search, \
content_type=content_type, \
extras=extras, group_id=group_id, \
tag_mode=tag_mode)
return data
def _doget(method, auth=False, **params):
#uncomment to check you aren't killing the flickr server
#print "***** do get %s" % method
params = _prepare_params(params)
url = '%s%s/?api_key=%s&method=%s&%s%s'% \
(HOST, API, API_KEY, method, urlencode(params),
_get_auth_url_suffix(method, auth, params))
#another useful debug print statement
if (debug): print("_doget", url)
return minidom.parse(urlopen(url))
def _prepare_params(params):
"""Convert lists to strings with ',' between items."""
for (key, value) in list(params.items()):
if isinstance(value, list):
params[key] = ','.join([item for item in value])
return params
def _get_auth_url_suffix(method, auth, params):
"""Figure out whether we want to authorize, and if so, construct a suitable
URL suffix to pass to the Flickr API."""
authentication = False
# auth may be passed in via the API, AUTH may be set globally (in the same
# manner as API_KEY, etc). We do a few more checks than may seem necessary
# because we allow the 'auth' parameter to actually contain the
# authentication token, not just True/False.
if auth or AUTH:
token = userToken()
authentication = True;
elif auth != False:
token = auth;
authentication = True;
elif AUTH != False:
token = AUTH;
authentication = True;
# If we're not authenticating, no suffix is required.
if not authentication:
return ''
full_params = params
full_params['method'] = method
return '&auth_token=%s&api_sig=%s' % (token, _get_api_sig(full_params) )
def build_photo(photo):
url = photo.getAttribute('url_o')
height = photo.getAttribute('height_o')
width = photo.getAttribute('width_o')
title = photo.getAttribute('title')
id = photo.getAttribute('id')
return (url, height, width, title, id)
def get_min_upload_date(groupid):
"""Figure out the last time this script was run, so we only get recent pictures"""
if (os.path.exists(CONFIG_FILENAME)):
config = ConfigObj(CONFIG_FILENAME)
try:
return config[groupid]['min_upload_date']
except KeyError:
return '0'
else:
return '0'
def set_min_upload_date(groupid):
config = ConfigObj(CONFIG_FILENAME)
config[groupid] = {}
config[groupid]['min_upload_date'] = time()
config.write()
def get_groups():
config = ConfigObj(CONFIG_FILENAME)
return config['groups']
def sanitize_filename(filename):
import unicodedata
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore')
return ''.join(c for c in cleanedFilename if c in validFilenameChars)
def download_photos_from_group(image_root, groupid, min_upload_date):
print('Finding pictures for group: ' + groupid + ' since: ' + datetime.fromtimestamp(float(min_upload_date)).strftime("%Y-%m-%d %H:%M:%S"))
photos = photos_search(group_id=groupid, min_upload_date=min_upload_date, extras='url_o, original_format')
for photo in photos.getElementsByTagName('photo'):
(url, height, width, title, id) = build_photo(photo)
if (url != '' and height != '' and int(height) > 900):
try:
image = urlopen(url)
picture = image.read()
filename = os.path.join(image_root, id + '-' + sanitize_filename(string.replace(title, ' ', '-')) + url[-4:])
if not os.path.exists(filename):
fout = open(filename, 'wb')
fout.write(picture)
fout.close()
print('Saved ' + filename)
else:
print('Skipped ' + filename)
except IOError:
print('Error on url: ' + url + ', skipping')
def get_image_root():
config = ConfigObj(CONFIG_FILENAME)
return config['image_root']
def get_api_key():
config = ConfigObj(CONFIG_FILENAME)
return config['api_key']
if __name__ == '__main__':
sys.exit(main(*sys.argv))

25
script/git-walk Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env ruby
# Walks up and down revisions in a git repo.
# Usage:
# git walk next
# git walk prev
case ARGV[0]
when "next"
rev_list = `git rev-list --children --all`
refs = rev_list.scan(/[a-z0-9]{40}(?= )/)
refs.unshift(rev_list[/[a-z0-9]{40}/])
refs.reverse!
head = `git rev-parse HEAD`.chomp
ref_for_next_commit = refs[refs.index(head) + 1]
if ref_for_next_commit
puts `git checkout #{ref_for_next_commit}`
else
puts "You're already on the latest commit."
end
when "prev"
puts `git checkout HEAD^`
else
puts "Usage: git-walk next|prev"
end

8
script/gtk-theme-toggler Executable file
View file

@ -0,0 +1,8 @@
#! /bin/bash
function tog () {
sed -i 's/gtk-theme-name=.*/gtk-theme-name="'"$1"'"/g' "$HOME/.gtkrc-2.0"
sed -i 's/gtk-theme-name=.*/gtk-theme-name='"$1"'/g' "$HOME/.config/gtk-3.0/settings.ini"
}
tog "$1"

3
script/kexec-now Executable file
View file

@ -0,0 +1,3 @@
#! /bin/sh
kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initrd.img-$(uname -r) --reuse-cmdline
systemctl kexec

19
script/markdown-toc.rb Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env ruby
require 'uri'
fileName = ARGV[0]
fileName = "README.md" if !fileName
File.open(fileName, 'r') do |f|
inside_code_snippet = false
f.each_line do |line|
forbidden_words = ['Table of contents', 'define', 'pragma']
inside_code_snippet = !inside_code_snippet if line.start_with?('```')
next if !line.start_with?("#") || forbidden_words.any? { |w| line =~ /#{w}/ } || inside_code_snippet
title = line.gsub("#", "").strip
href = URI::encode title.gsub(" ", "-").downcase
puts " " * (line.count("#")-1) + "* [#{title}](\##{href})"
end
end

12
script/openport.js Executable file
View file

@ -0,0 +1,12 @@
#! /usr/bin/env node
const openport = require('openport');
openport.find({ startingPort: 1024, endingPort: 60000 }, (err, port) => {
if(err) {
process.exit(1);
}
console.log(port);
process.exit(0);
});

17
script/package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "dotfiles-script",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"lint": "eslint .",
"debug:docker": "nodemon --inspect-brk -- ./docker.js --debug"
},
"dependencies": {
"openport": "^0.0.6"
},
"devDependencies": {
"eslint": "^7.8.1",
"nodemon": "^2.0.4"
}
}

1434
script/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

16
script/svn-diffwrap Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
# Configure your favorite diff program here.
DIFF="/usr/bin/vimdiff"
# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}
# Call the diff command (change the following line to make sense for
# your merge program).
$DIFF $LEFT $RIGHT
# Return an errorcode of 0 if no differences were detected, 1 if some were.
# Any other errorcode will be treated as fatal.

21
script/unfuckusb.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# Script to reset all local xHCI (USB) controllers
# Based on: http://billauer.co.il/blog/2013/02/usb-reset-ehci-uhci-linux/
if [[ ${EUID} != 0 ]]; then
echo This must be run as root!
exit 1
fi
for xhci in /sys/bus/pci/drivers/?hci_hcd; do
if ! cd ${xhci}; then
echo "Weird error. Failed to change directory to ${xhci}."
exit 1
fi
echo "Resetting devices from ${xhci}..."
for i in ????:??:??.?; do
echo -n "${i}" > unbind
echo -n "${i}" > bind
done
done

2
script/vimcat Executable file
View file

@ -0,0 +1,2 @@
#! /bin/bash
"$HOME/.vim/plugged/vimcat/vimcat" "$@"

178
setup/setup.sh Executable file
View file

@ -0,0 +1,178 @@
#! /bin/bash
set -e
which gls 2>/dev/null && IS_BREW=1 || IS_BREW=0
IS_DARWIN=$((0))
IS_LINUX=$((0))
IS_WINDOWS=$((0))
LINKS_ONLY=$((0))
case "$OSTYPE" in
linux-*) IS_LINUX=$((1)) ;;
darwin*) IS_DARWIN=$((1)) ;;
*) IS_WINDOWS=$((1)) ;;
esac
USE_NPM=$((1))
while [ -n "$1" ] ; do
case "$1" in
--skip-npm) USE_NPM=$((0)) ;;
--links-only) LINKS_ONLY=$((1)) ;;
esac
shift
done
curlorwget () {
curl -sL "$@" | wget -qO- "$@"
}
setuplink () {
local SRCPATH="$1"
local DEST="$2"
if [ -f "$DEST" ] ; then
mv -v "$DEST" "$DEST.bak" || echo "$DEST already exists."
fi
if [ ! -e "$DEST" ] ; then
local MDIR
if ((IS_WINDOWS)) ; then
echo "$DEST -> $SRCPATH"
if [ -d "$each" ] ; then
MDIR="/d"
else
MDIR=""
fi
# Also, screw any version of Windows other than 10.
powershell.exe -Command New-Item -ItemType SymbolicLink -Path "$(cygpath -w "$DEST")" -Value "$(cygpath -w "$SRCPATH")"
else
ln -v -s "$SRCPATH" "$DEST"
fi
fi
}
setuplinks () {
local SRC="$1"
local DESTBASE="$2"
local SRCPATH
find "$SRC" -maxdepth 1 -not -iname setup -not -iname .. -not -iname . -not -iname .git -not -iname .config -not -iname xfce4 -not -iname '.tern-*' | while read SRCPATH ; do
local DEST="$DESTBASE/$(basename "$SRCPATH")"
setuplink "$SRCPATH" "$DEST"
done
}
ADDG=
((IS_BREW)) && ADDG="g"
CURDIR="$(dirname $(${ADDG}readlink -f "$0"))"
CACHEDIR="$HOME/.cache/dotfiles"
which pacman 2>&1 >/dev/null && IS_PACMAN=1 || IS_PACMAN=0
which apt 2>&1 >/dev/null && IS_SUPERCOW=1 || IS_SUPERCOW=0
IS_SUPERCOW=$((!IS_BREW && IS_SUPERCOW))
mkdir -p "$CACHEDIR"
# This will probably get annoying...
setuplinks "$CURDIR/.." "$HOME"
# We don't want to include this whole folder because lots of apps live here. Need some control...
setuplinks "$CURDIR/../.config" "$HOME/.config"
mkdir -p "$HOME/.config/xfce4"
setuplinks "$CURDIR/../.config/xfce4" "$HOME/.config/xfce4"
mkdir -p "$HOME/.config/dark-mode-notify"
setuplinks "$CURDIR/../.config/dark-mode-notify" "$HOME/.config/dark-mode-notify"
setuplink "$CURDIR/../.vim" "$HOME/vimfiles"
setuplink "$CURDIR/../.nvim" "$HOME/.config/nvim"
mkdir -p "$HOME/.bashrc.local.d"
((LINKS_ONLY)) && exit 0
if ((IS_WINDOWS)) ; then
# Git Bash: 'msys'
choco upgrade python nodejs neovim
((USE_NPM)) && npm install -g pnpm
((USE_NPM)) && pnpm add -g tern
else
if ((IS_PACMAN)) ; then
# pstree untested
# silversearcher-ag untested
sudo pacman -S python-pip python2-pip vim ruby pstree silversearcher-ag neovim
yay direnv
elif ((IS_SUPERCOW)) ; then
echo "USING APT"
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | sudo dd of=/etc/apt/trusted.gpg.d/vscodium.gpg
echo 'deb https://paulcarroty.gitlab.io/vscodium-deb-rpm-repo/debs/ vscodium main' | sudo tee --append /etc/apt/sources.list.d/vscodium.list
curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash -
sudo apt update
sudo apt install blueman network-manager-gnome python3-pip python3-configobj fonts-powerline direnv vim-nox ruby silversearcher-ag nodejs jq codium pasystray gxkb rofi xdotool x11-xserver-utils indent libanyevent-i3-perl feh tk i3lock xautolock fonts-noto fonts-material-design-icons-iconfont fonts-materialdesignicons-webfont polybar fonts-font-awesome i3 curl playerctl xfce4-screenshooter imagemagick diodon fcitx-bin fcitx-mozc fcitx-imlist
curlorwget https://releases.hyper.is/download/deb > "$CACHEDIR/hyper.deb"
sudo dpkg -i "$CACHEDIR/hyper.deb" || sudo apt install -f
curlorwget http://cloudfront.debian.net/debian/pool/main/f/fonts-noto-color-emoji/fonts-noto-color-emoji_0~20200916-1_all.deb > "$CACHEDIR/noto-emoji.deb"
sudo dpkg -i "$CACHEDIR/noto-emoji.deb"
sudo apt install -f
elif ((IS_BREW)) ; then
brew install ipython direnv ruby vim nodejs pstree bash-completion ag neovim pyenv jq coreutils findutils fzf
fi
((USE_NPM && !IS_BREW)) && sudo npm install -g pnpm
((USE_NPM && !IS_BREW)) && sudo pnpm add -g tern
fi
vim '+PlugInstall' '+qall!'
if ((!IS_BREW)) ; then
# Find package.jsons and reinstall all node packages
find "$CURDIR" -iname package.json | while read FILENAME ; do
PACKAGEDIR="$(dirname "$FILENAME")"
if [[ -e "$PACKAGEDIR/node_modules" ]] ; then
continue
fi
(
cd "$PACKAGEDIR"
yarn install
)
done
# For neovim
pyenv update
pyenv install 2.7.11
pyenv install 3.4.4
pyenv virtualenv 2.7.11 neovim2
pyenv virtualenv 3.4.4 neovim3
pyenv activate neovim2
pip install neovim
PYPATH2=$(pyenv which python)
pyenv activate neovim3
pip install neovim
PYPATH3=$(pyenv which python)
pip3 install --upgrade --user i3-workspace-names-daemon
pip3 install --upgrade --user neovim
pip install --upgrade --user neovim websocket-client sexpdata
echo "$PYPATH2"
echo "$PYPATH3"
curl https://sdk.cloud.google.com | bash
else
cd $HOME/.vim/plugged/dark-mode-notify
sudo make install
fi

4
yarn.lock Normal file
View file

@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1