This commit is contained in:
Øyvind Jensen 2025-04-27 21:57:27 +02:00
commit 90f92d4c66
20 changed files with 425 additions and 0 deletions

1
.bashrc Normal file
View file

@ -0,0 +1 @@
source ~/.shrc

33
.config/sxhkd/sxhkdrc Normal file
View file

@ -0,0 +1,33 @@
# Reload functions
super + o
bookmarks
super + i
web https://duckduckgo.com
super + alt + n
setxkbmap no
super + alt + f
setxkbmap fi
super + ctrl + t
transset 0.7
super + alt + k
xdotool mousemove_relative -- 0 -10
super + alt + j
xdotool mousemove_relative 0 10
super + alt + h
xdotool mousemove_relative -- -10 0
super + alt + l
xdotool mousemove_relative 10 0
super + alt + y
xdotool click 1
super + alt + u
xdotool click 2
super + alt + i
xdotool click 3
super + alt + w
selplumb
super + ctrl + r
record-start
super + ctrl + x
record-stop
super + alt + g
grab

27
.profile Normal file
View file

@ -0,0 +1,27 @@
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi

22
.shrc Normal file
View file

@ -0,0 +1,22 @@
alias ls="ls --color=auto"
alias python="python3"
alias pip="pip3"
alias c="rlwrap clojure"
alias x=startx
alias fd=fdfind
alias ↓=vil
alias dmenu="dmenu -nf '#BBBBBB' -nb '#222222' -sb '#A02C4E' -sf '#EEEEEE' -fn terminus"
alias f="fzf --layout=reverse --height=40% --color=dark | xargs -r plumb"
alias a="fd | fzf --reverse --height 40% | xargs -r acme"
alias xterm="st"
alias dc="docker-compose"
alias w3m="w3m -o auto_image=FALSE"
alias less="less -R"
alias vi=vis
alias ll="ls -alG"
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export OPENER=plumb
export PLAN9=~/bin/`uname -m`/plan9port
export PATH=~/bin/`uname -m`:~/.local/bin:~/bin:$PATH:$PLAN9/bin

9
.xinitrc Normal file
View file

@ -0,0 +1,9 @@
setxkbmap -layout no
sxhkd &
plumber &
feh --bg-tile ~/img/bg.png
while true; do
xsetroot -name "`date`"
sleep 60
done &
exec dwm

32
.zshrc Normal file
View file

@ -0,0 +1,32 @@
autoload -Uz promptinit
promptinit
prompt redhat
setopt histignorealldups sharehistory
HISTSIZE=5000
SAVEHIST=5000
HISTFILE=~/.zsh_history
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
source ~/.shrc

14
README.md Normal file
View file

@ -0,0 +1,14 @@
Files and suggestions to make life a bit easier.
# deps
For Debian GNU/Linux based systems:
apt install fzf dwm dmenu stterm python3 python3-webview tesseract-ocr tesseract-ocr-eng scrot xserver-xephyr ffmpeg xdotool podman redshift feh rlwrap w3m vis
Additional deps not in Debian GNU/Linux stable:
* [bb](https://babashka.org)
* [p9p](https://9fans.github.io/plan9port/)
* [nrepl-python-client](https://pypi.org/project/nrepl-python-client/)

16
bin/bbrep Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bb
;; Based on:
;; https://book.babashka.org/#_interacting_with_an_nrepl_server
(ns nrepl-client
(:require [bencode.core :as b]))
(defn nrepl-eval [port expr]
(println (clojure.string/trim expr))
(let [s (java.net.Socket. "localhost" port)
out (.getOutputStream s)
in (java.io.PushbackInputStream. (.getInputStream s))
_ (b/write-bencode out {"op" "eval" "code" expr})
bytes (get (b/read-bencode in) "value")]
(println ";;" (String. bytes))))
(nrepl-eval 1667 (slurp *in*))

2
bin/bookmarks Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
cat ~/bookmarks* | sort | uniq | dmenu -i -l 30 -sb "#303030" -fn terminus | awk -F ' | ' '{print $1}' | xargs -r plumb

6
bin/grab Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
FILE=/tmp/`dbus-uuidgen`.png
scrot -s $FILE
tesseract $FILE - --dpi 150 | xclip -i
rm $FILE

7
bin/journal Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
ENTRY=$@
if [ -n "$ENTRY" ]; then
echo "`date -Is`\t$@" >> journal
fi
cat journal

2
bin/nest.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
startx -- /usr/bin/Xephyr :1

20
bin/pyrep Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env python3
#
# Requirements: nrepl-python-client
#
import sys
import nrepl
code = sys.stdin.read().strip()
print(code)
c = nrepl.connect("nrepl://localhost:1667")
c.write({"op": "eval", "code": code})
response = c.read()
try:
print(";; " + response['value'])
except KeyError:
try:
print(";; ERROR: " + response['err'])
except KeyError:
pass

2
bin/record-start Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0 out-$(date +%s).mp4

2
bin/record-stop Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
ps aux | grep ffmpeg | grep x11 | awk '{print $2}' | xargs kill

9
bin/selplumb Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
TXT=$(xclip -o)
CWD=$(readlink /proc/$(pgrep -P $(xdotool getactivewindow getwindowpid))/cwd)
if [ -f "$CWD/$TXT" ]; then
plumb "$CWD/$TXT"
else
plumb "$TXT"
fi

182
bin/vil Executable file
View file

@ -0,0 +1,182 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# List System
# Copyright (C) 2011 Øyvind Jensen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import cmd
import shelve
import os
class CLI(cmd.Cmd):
header = 'Virtual Inventory Logger'
prompt = '> '
storage = None
snd = None
filename = 'registry'
unablemsg = 'Unable to complete operation'
def complete_most(self, text, line):
col = []
for key in self.storage.keys():
col.append(key)
for item in self.storage[key]:
col.append(item)
if text:
return [
key for key in col
if key.startswith(text)
]
else:
return col
def log(self, line):
os.system('journal ' + line)
def do_place(self, op):
'USAGE: place <name> <location>'
thinglocation = op.split()
thinglocation = self.strip(thinglocation)
if len(thinglocation) == 2:
location = thinglocation[1]
name = thinglocation[0]
try:
self.storage[location]
except KeyError:
self.storage[location] = []
self.storage[location].append(name)
response = name + ' placed in ' + location
self.log(response)
else:
print(self.unablemsg)
def complete_place(self, text, line, start_index, end_index):
return self.complete_most(text, line)
def do_search(self, phrase):
'USAGE: search <name>'
found = False
if len(phrase) > 0:
for location in self.storage:
for item in self.storage[location]:
if phrase in item or item in phrase:
print(item + ' is located in ' + location)
found = True
if not found:
print(phrase + ' is nowhere to be found')
print('Please get one and put it somewhere')
else:
print(self.unablemsg)
def do_remove(self, op):
'USAGE: remove <name> <location>'
thinglocation = op.split()
thinglocation = self.strip(thinglocation)
if len(thinglocation) == 2:
location = thinglocation[1]
name = thinglocation[0]
try:
self.storage[location].remove(name)
if len(self.storage[location]) == 0:
self.storage.pop(location)
response = name + ' removed from ' + location
self.log(response)
except:
print(name + ' not found in ' + location)
else:
print(self.unablemsg)
def complete_remove(self, text, line, start_index, end_index):
return self.complete_most(text, line)
def do_move(self, op):
'USAGE: move <name> <from location> <to location>'
moveop = op.split()
moveop = self.strip(moveop)
if len(moveop) == 3:
name = moveop[0]
fromloc = moveop[1]
toloc = moveop[2]
self.do_remove(name + ' ' + fromloc)
self.do_place(name + ' ' + toloc)
#print(name + ' moved from ' + fromloc + ' to ' + toloc)
else:
print(self.unablemsg)
def complete_move(self, text, line, start_index, end_index):
return self.complete_most(text, line)
def do_list(self, location):
'USAGE: list <location>'
if len(location) > 0:
self.list_location(location)
else:
for onelocation in self.storage:
self.list_location(onelocation)
def complete_list(self, text, line, start_index, end_index):
return self.complete_most(text, line)
def do_journal(self, line):
'USAGE: journal <journal entry>'
os.system('journal ' + line)
def strip(self, tostrip):
words = ['in', 'from', 'inside', 'into']
for word in words:
if word in tostrip:
tostrip.remove(word)
return tostrip
def list_location(self, location):
print(location)
try:
if self.storage[location] is not None:
for item in self.storage[location]:
print('\t' + item)
except KeyError:
print('There is no place like ' + location)
def do_copyright(self, line):
print("Copyright (C) 2011- Øyvind Jensen")
def do_credits(self, line):
print("Author:")
print("Øyvind Jensen")
print("oyvind.jensen@protonmail.com")
def do_exit(self, line):
print('Be well..')
return True
def __init__(self):
cmd.Cmd.__init__(self)
self.storage = shelve.open(self.filename, writeback = True)
def do_EOF(self, line):
print()
return self.do_exit('')
def complete(self, text, state):
"""Add a whitespace after word completion"""
return cmd.Cmd.complete(self, text, state) + ' '
if __name__ == "__main__":
CLI().cmdloop()

36
bin/web Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Minimal web browser
# Copyright (C) 2020 Øyvind Jensen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import webview
evaluate = lambda window: window.evaluate_js(script)
window = webview.create_window('Web', sys.argv[1], text_select=True)
window.loaded += lambda: window.evaluate_js("""
document.addEventListener("keydown", event => {
event.keyCode == 8?
history.back()
:
event.keyCode == 18?
location.reload()
:
null
})
""")
webview.start(evaluate, window, http_server=True)

3
bin/xalpine Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
xhost +"local:podman@"
podman run -it --rm -u 0 -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix:rw alpine sh

BIN
img/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B