small update

This commit is contained in:
Kyle Brown 2022-11-17 16:19:14 -08:00
parent aa9286a4ab
commit 42278268e7
5 changed files with 134 additions and 2 deletions

3
.scripts/changewallpaper Executable file
View file

@ -0,0 +1,3 @@
#!/bin/zsh
#wal -i wallpapers --iterative --saturate 0.8 -b "#222222" -s && source ~/.zshrc
wal -i wallpapers --iterative --saturate 0.8

83
.scripts/platerpartscount.py Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env python3
import argparse
import sys
import re
import os
def parse_args():
parser = argparse.ArgumentParser(
description='searches directory for STL files and creates ' \
+ 'accent.conf and normal.conf config files for plater ' \
+ 'in the current directory')
parser.add_argument(
'--escape', '-e',
action = 'store_true',
help = 'wether or not to escape filenames'
)
parser.add_argument(
'--verbose', '-v',
action = 'store_true',
help = 'print out the contents of the files'
)
parser.add_argument(
'directory',
help = 'the directory to search'
)
return parser.parse_args()
# _{name}_x{quantity}_{revision}.stl
# _{name}_x{quantity}.stl
# _{name}_{revision}.stl
# _{name}.stl
r = re.compile(r'_x(\d+)(_[^_]+)?.stl$',re.IGNORECASE)
def count_from_filename(filename):
m = r.search(filename)
return m and int(m.group(1)) or 1
def escape(filename):
# TODO more os specific escape? what does plater need on windows?
return re.sub('( )', r'\\\1', filename)
def process_dir():
stl = re.compile(r'.stl$',re.IGNORECASE)
accented = re.compile(r'^(_|a_|\[a])')
accents = []
normals = []
for root, dirnames, filenames in os.walk(args.directory):
for filename in filter(stl.search,filenames):
fullpath = os.path.join(root, filename)
count = count_from_filename(filename)
both = (fullpath, count)
if accented.match(filename):
accents.append(both)
else:
normals.append(both)
return (accents, normals)
def output_files(accents, normals):
for output, files in [
('accent.conf', accents),
('normal.conf', normals) ]:
if args.escape:
files = [ (escape(fullpath), count) for fullpath, count in files]
print("Making " + output)
output_file = open(output, "w+")
for info in files:
output_file.write("%s %s\n" % info)
if args.verbose:
output_file.seek(0,0)
for line in output_file:
sys.stdout.write(line)
sys.stdout.flush()
output_file.close
if __name__ == "__main__":
args = parse_args()
accents, normals = process_dir()
output_files(accents,normals)

44
.scripts/vimv Executable file
View file

@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -eu
# Lists the current directory's files in Vim, so you can edit it and save to rename them
# USAGE: vimv [file1 file2]
# https://github.com/thameera/vimv
declare -r FILENAMES_FILE=$(mktemp "${TMPDIR:-/tmp}/vimv.XXX")
trap '{ rm -f "${FILENAMES_FILE}" ; }' EXIT
if [ $# -ne 0 ]; then
src=( "$@" )
else
IFS=$'\r\n' GLOBIGNORE='*' command eval 'src=($(ls))'
fi
for ((i=0;i<${#src[@]};++i)); do
echo "${src[i]}" >> "${FILENAMES_FILE}"
done
${EDITOR:-vi} "${FILENAMES_FILE}"
IFS=$'\r\n' GLOBIGNORE='*' command eval 'dest=($(cat "${FILENAMES_FILE}"))'
if (( ${#src[@]} != ${#dest[@]} )); then
echo "WARN: Number of files changed. Did you delete a line by accident? Aborting.." >&2
exit 1
fi
declare -i count=0
for ((i=0;i<${#src[@]};++i)); do
if [ "${src[i]}" != "${dest[i]}" ]; then
mkdir -p "$(dirname "${dest[i]}")"
if git ls-files --error-unmatch "${src[i]}" > /dev/null 2>&1; then
git mv "${src[i]}" "${dest[i]}"
else
mv "${src[i]}" "${dest[i]}"
fi
((++count))
fi
done
echo "$count" files renamed.

View file

@ -81,8 +81,8 @@ cmd - h [
# Open Emacs
cmd + shift - n : /opt/homebrew/bin/emacsclient -a "emacs" -cn
# Hide Dock
cmd + shift - h : defaults write com.apple.dock autohide -bool true && defaults write com.apple.dock autohide-delay -float 5 && defaults write com.apple.dock no-bouncing -bool TRUE && killall Dock
cmd + shift - h : defaults write com.apple.dock autohide -bool true && defaults write com.apple.dock autohide-delay -float 5 && defaults write com.apple.dock no-bouncing -bool TRUE && defaults write com.apple.dock autohide-time-modifier -float 20000000000; killall Dock
# Show Dock
cmd + shift - d : defaults write com.apple.dock autohide -bool true && defaults delete com.apple.dock autohide-delay && defaults write com.apple.dock no-bouncing -bool FALSE && killall Dock
cmd + shift - d : defaults write com.apple.dock autohide -bool true && defaults delete com.apple.dock autohide-delay && defaults write com.apple.dock no-bouncing -bool FALSE && defaults write com.apple.dock autohide-time-modifier -float 1; killall Dock
# Open Firefox window
cmd + shift - f : /Applications/Firefox.app/Contents/MacOS/firefox -new-window

View file

@ -42,6 +42,8 @@ set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for
set -g @plugin 'tmux-plugins/tmux-yank' # integrates system clipboard
set-option -g @plugin 'b0o/tmux-autoreload' #automatically reloads the config
set -g @plugin 'noscript/tmux-mighty-scroll' # better mouse scroll
set -g @plugin 'tmux-plugins/tmux-fpp'
set -g @plugin 'laktak/extrakto'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'