Compare commits
10 commits
8e5f4e4d9e
...
8785b81184
Author | SHA1 | Date | |
---|---|---|---|
|
8785b81184 | ||
|
3f11bead74 | ||
|
18c36c7340 | ||
a265698276 | |||
110a876cdc | |||
|
55c0f11b40 | ||
|
e9243344a8 | ||
|
5a634016cf | ||
|
d250409d5f | ||
|
9cda0e04d8 |
9 changed files with 236 additions and 13 deletions
4
gdk_scale
Executable file
4
gdk_scale
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
export GDK_SCALE=$1 GDK_DPI_SCALE=$(printf '%.1f' $((1.0/$1)))
|
||||||
|
exec $2
|
|
@ -4,7 +4,7 @@
|
||||||
from sys import argv
|
from sys import argv
|
||||||
|
|
||||||
def from_base256(number):
|
def from_base256(number):
|
||||||
num = int(number)
|
num = int(number, 16)
|
||||||
addr = list()
|
addr = list()
|
||||||
for e in range(3, -1, -1):
|
for e in range(3, -1, -1):
|
||||||
multiplier = 256 ** e
|
multiplier = 256 ** e
|
||||||
|
@ -20,7 +20,7 @@ def to_base256(addr):
|
||||||
for e in range(3, -1, -1):
|
for e in range(3, -1, -1):
|
||||||
num += int(addr[3-e]) * 256 ** e
|
num += int(addr[3-e]) * 256 ** e
|
||||||
|
|
||||||
return str(num)
|
return '{0:08x}'.format(num)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = from_base256(argv[1])
|
result = from_base256(argv[1])
|
27
is_private
Executable file
27
is_private
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
typeset -ga PRIVATE_RANGES=(
|
||||||
|
00001010 # 10.0.0.0/8
|
||||||
|
101011000001 # 172.16.0.0/12
|
||||||
|
1100000010101000 # 192.168.0.0/16
|
||||||
|
)
|
||||||
|
|
||||||
|
test_range() {
|
||||||
|
typeset net addr=$(printf '%.2x' ${(s:.:)1})
|
||||||
|
for net in $PRIVATE_RANGES; do
|
||||||
|
((16#$addr >> (32 - $#net) == 2#$net)) && return 0
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
report() {
|
||||||
|
typeset result='private' addr=$1 state=$2
|
||||||
|
((state)) && result='not private'
|
||||||
|
printf "%s is %s\n" $addr $result
|
||||||
|
exit $state
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
test_range $1 && report $1 0
|
||||||
|
report $1 1
|
||||||
|
}
|
||||||
|
|
||||||
|
main $1
|
51
post-autorandr
Executable file
51
post-autorandr
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# xsettingsd systemd unit:
|
||||||
|
# --
|
||||||
|
# [Unit]
|
||||||
|
# Description=xsettingsd magic
|
||||||
|
#
|
||||||
|
# [Service]
|
||||||
|
# ExecStart=/usr/bin/xsettingsd
|
||||||
|
# ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
#
|
||||||
|
# [Install]
|
||||||
|
# WantedBy=default.target
|
||||||
|
# --
|
||||||
|
XSETTINGSD_TEMPLATE='Xft/Hinting 1\nXft/HintStyle "hintslight"\nXft/Antialias 1\nXft/RGBA "rgb"\nXft/DPI %s\n'
|
||||||
|
XSETTINGSD_CONFIG=/run/user/$UID/xsettingsd-config
|
||||||
|
|
||||||
|
XKB_OPTS='grp:win_space_toggle,compose:menu'
|
||||||
|
XKB_LAYOUTS='us(altgr-intl),ru(typewriter)'
|
||||||
|
|
||||||
|
WALLPAPER=$HOME/.wallpaper
|
||||||
|
|
||||||
|
TOUCHPAD_DEV='SynPS/2 Synaptics TouchPad'
|
||||||
|
|
||||||
|
DPI=${1:-96}
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# reset xkbmap, set xkbmap
|
||||||
|
setxkbmap us -option
|
||||||
|
setxkbmap $XKB_LAYOUTS -option $XKB_OPTS
|
||||||
|
|
||||||
|
# configure touchpad
|
||||||
|
xinput set-prop $TOUCHPAD_DEV 'libinput Click Method Enabled' 0 1
|
||||||
|
xinput set-prop $TOUCHPAD_DEV 'libinput Middle Emulation Enabled' 1
|
||||||
|
|
||||||
|
# background
|
||||||
|
feh --bg-fill $WALLPAPER
|
||||||
|
|
||||||
|
# dpi - xsettignsd, has to be started here because config is absent on boot
|
||||||
|
printf $XSETTINGSD_TEMPLATE $(($DPI * 1024)) > $XSETTINGSD_CONFIG
|
||||||
|
systemctl --quiet --user is-active xsettingsd || systemctl --user start xsettingsd
|
||||||
|
systemctl --user reload xsettingsd.service
|
||||||
|
|
||||||
|
# dpi - other
|
||||||
|
xrdb -merge <(echo "Xft.dpi: $DPI")
|
||||||
|
xrandr --dpi $DPI
|
||||||
|
i3-msg restart
|
||||||
|
|
||||||
|
# report
|
||||||
|
current_config=$(autorandr --current)
|
||||||
|
notify-send "$current_config config applied"
|
111
q3srv
Executable file
111
q3srv
Executable file
|
@ -0,0 +1,111 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
from os import system
|
||||||
|
from random import shuffle
|
||||||
|
from sys import exit
|
||||||
|
|
||||||
|
# TODO: move this shit to a yaml config somewhere in /etc
|
||||||
|
USER = 'quake3' # linux user, for sudo -u
|
||||||
|
BIN = '/usr/bin/q3ded'
|
||||||
|
CONF = '/srv/q3/.q3a/baseq3/autoexec.cfg'
|
||||||
|
PARAM = '+exec autoexec.cfg'
|
||||||
|
|
||||||
|
MAPLISTS = {
|
||||||
|
'ffa': [
|
||||||
|
'q3dm2', 'q3dm3', 'q3dm4', 'q3dm5', 'q3dm6',
|
||||||
|
'q3dm7', 'q3dm8', 'q3dm9', 'q3dm10', 'q3dm11'
|
||||||
|
],
|
||||||
|
'duel': [
|
||||||
|
'q3dm1', 'q3dm2', 'pro-q3dm6', 'pro-q3dm13',
|
||||||
|
'q3tourney1', 'q3tourney3', 'q3tourney5', 'q3tourney6',
|
||||||
|
'pro-q3tourney2', 'pro-q3tourney4'
|
||||||
|
],
|
||||||
|
'ctf': list()
|
||||||
|
}
|
||||||
|
BOTS = {
|
||||||
|
'level': '3',
|
||||||
|
'names': [
|
||||||
|
'Anarki', 'Angel', 'Crash', 'Doom', 'Hunter',
|
||||||
|
'Klesk', 'Major', 'Mynx', 'Orbb', 'Slash', 'Xaero'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# these are saved to the q3config_server.cfg on the first run
|
||||||
|
# no point in keeping them here afterwards
|
||||||
|
BOOTSTRAP_OPTS = dict()
|
||||||
|
# BOOTSTRAP_OPTS = {
|
||||||
|
# 'sv_pure': '0', # enable client side mods, like better fonts or graphics
|
||||||
|
# 'sv_maxclients': '8',
|
||||||
|
# 'sv_hostname': 'myhost.tld'
|
||||||
|
#
|
||||||
|
# # this will let your server send maps to clients
|
||||||
|
# # the downloads are attempted from http://%sv_dlURL%/baseq3/mapname.pk3
|
||||||
|
# # note the protocol - no support for https,
|
||||||
|
# # as well as the need to have baseq3 as a part of the path
|
||||||
|
# # note that clients have to seta cl_allowDownload 1 for that to work
|
||||||
|
# 'sv_dlURL': 'anyhost.tld/q3',
|
||||||
|
# 'sv_allowDownloads': '1'
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
def parse_arguments():
|
||||||
|
desc = 'host a q3 server'
|
||||||
|
parser = ArgumentParser(description=desc)
|
||||||
|
parser.add_argument('-m', '--gamemode', default='ffa')
|
||||||
|
parser.add_argument('-f', '--fraglimit', type=int, default=15)
|
||||||
|
parser.add_argument('-t', '--timelimit', type=int, default=10)
|
||||||
|
parser.add_argument('-b', '--bots', type=int, default=0)
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def gen_confline(param, value):
|
||||||
|
return 'seta {} "{}"\n'.format(param, value)
|
||||||
|
|
||||||
|
|
||||||
|
def gen_maplist(maplist):
|
||||||
|
shuffle(maplist)
|
||||||
|
num = 1
|
||||||
|
stmpl = 'set d{} "map {} ; set nextmap vstr d{}"\n'
|
||||||
|
script = str()
|
||||||
|
while maplist:
|
||||||
|
nextnum = 1 if len(maplist) == 1 else num + 1
|
||||||
|
script += stmpl.format(num, maplist.pop(), nextnum)
|
||||||
|
num += 1
|
||||||
|
script += 'vstr d1\n'
|
||||||
|
return script
|
||||||
|
|
||||||
|
|
||||||
|
def gen_addbots(count, level='3', names=list()):
|
||||||
|
shuffle(names)
|
||||||
|
btmpl = 'addbot {} {}\n'
|
||||||
|
script = str()
|
||||||
|
for bot in names[:count]:
|
||||||
|
script += btmpl.format(bot, level)
|
||||||
|
return script
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parse_arguments()
|
||||||
|
cfg_data = str()
|
||||||
|
try:
|
||||||
|
assert args.gamemode in MAPLISTS
|
||||||
|
except AssertionError:
|
||||||
|
exit('Wrong game mode specified!')
|
||||||
|
|
||||||
|
for param in BOOTSTRAP_OPTS:
|
||||||
|
cfg_data += gen_confline(param, BOOTSTRAP_OPTS[param])
|
||||||
|
cfg_data += gen_confline('fraglimit', args.fraglimit)
|
||||||
|
cfg_data += gen_confline('timelimit', args.timelimit)
|
||||||
|
# this should be last since it launches the actual maplist
|
||||||
|
cfg_data += gen_maplist(MAPLISTS[args.gamemode])
|
||||||
|
if args.bots:
|
||||||
|
cfg_data += gen_addbots(args.bots, **BOTS)
|
||||||
|
|
||||||
|
with open(CONF, 'w+') as config:
|
||||||
|
config.write(cfg_data)
|
||||||
|
system('sudo -u {} {} {}'.format(USER, BIN, PARAM))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
21
termcompat
21
termcompat
|
@ -1,9 +1,14 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env zsh
|
||||||
# run with more compatible TERM value
|
# run with more compatible TERM value
|
||||||
typeset -A terms=(
|
case $TERM in
|
||||||
[xterm-kitty]='xterm'
|
(st-*) ;&
|
||||||
[rxvt-unicode-256color]='rxvt-unicode'
|
(alacritty*) ;&
|
||||||
[st-256color]='xterm-256color'
|
(xterm-kitty) ;&
|
||||||
[tmux-256color]='screen.xterm-new'
|
export TERM=xterm;;
|
||||||
)
|
(rxvt-unicode-*)
|
||||||
TERM="${terms[$TERM]:-$TERM}" exec "$@"
|
export TERM=rxvt-unicode;;
|
||||||
|
(tmux-*)
|
||||||
|
export TERM=screen.xterm-new;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# a simple script to test 24 bit compatibility in a terminal
|
# a simple script to test 24 bit compatibility in a terminal
|
||||||
# source: https://gist.github.com/XVilka/8346728
|
# source: https://gist.github.com/XVilka/8346728
|
||||||
BEGIN{
|
BEGIN{
|
||||||
s="▀▀▀▀▀▀▀▀▀▀"; s=s s s s s s s s;
|
s="=========="; s=s s s s s s s s;
|
||||||
for (colnum = 0; colnum<77; colnum++) {
|
for (colnum = 0; colnum<77; colnum++) {
|
||||||
r = 255-(colnum*255/76);
|
r = 255-(colnum*255/76);
|
||||||
g = (colnum*510/76);
|
g = (colnum*510/76);
|
||||||
|
|
25
vcascadia-gen.sh
Executable file
25
vcascadia-gen.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
###
|
||||||
|
# https://github.com/microsoft/cascadia-code
|
||||||
|
# ss01 - handwritten italic
|
||||||
|
# ss02 - lua not equals ~=
|
||||||
|
# ss03 - serbian locale
|
||||||
|
# ss19 - slashed zero 0
|
||||||
|
# ss20 - graphical control characters
|
||||||
|
###
|
||||||
|
# opentype-feature-freezer is necessary, install with pipx or pip
|
||||||
|
# pip install --upgrade opentype-feature-freezer
|
||||||
|
###
|
||||||
|
|
||||||
|
name=VascadiaMod
|
||||||
|
arch=$name.tgz
|
||||||
|
ss=ss01,ss19,ss20
|
||||||
|
|
||||||
|
for font in CascadiaCodePL*.otf; do
|
||||||
|
src=$font
|
||||||
|
dst=${font/CascadiaCodePL/$name}
|
||||||
|
|
||||||
|
pyftfeatfreeze -f $ss -R "Cascadia Code PL/$name" $src $dst
|
||||||
|
done
|
||||||
|
|
||||||
|
eval tar -acvf $arch $name*
|
|
@ -35,13 +35,13 @@ function parse_actions
|
||||||
case $action in
|
case $action in
|
||||||
(LOCK|BLANK)
|
(LOCK|BLANK)
|
||||||
setxkbmap us -option
|
setxkbmap us -option
|
||||||
notify-send DUNST_COMMAND_PAUSE
|
dunstctl set-paused true
|
||||||
;;
|
;;
|
||||||
(UNBLANK)
|
(UNBLANK)
|
||||||
check_start gxkb
|
check_start gxkb
|
||||||
$HOME/git/mine/vscripts/mykblayouts
|
$HOME/git/mine/vscripts/mykblayouts
|
||||||
$HOME/.local/bin/touchpad-config
|
$HOME/.local/bin/touchpad-config
|
||||||
notify-send DUNST_COMMAND_RESUME
|
dunstctl set-paused false
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue