Skip to content

Instantly share code, notes, and snippets.

View tbnorth's full-sized avatar

Terry Brown tbnorth

View GitHub Profile
@tbnorth
tbnorth / citrix_i3.md
Last active February 5, 2024 21:13
Making Citrix Workspace client run in i3 window manager

Citrix Workspace client with i3 window manager

Update: works with 24.04(beta) too, and problem still exists in 24.04.

This is how I got the Citrix Workspace client to run in Ubuntu 23.10 in Jan. 2024

Prior to version 2311 Citrix client, this patch was unnecessary, but at 2311 Citrix stopped launching successfully at all in i3.

In XFCE Citrix runs with "proper" full screen support, covering three monitors but

# TNB mods
# bind -n == bind -T root == no prefix
set -g lock-after-time 0 # Seconds; 0 = never
bind -n C-Left select-window -p
bind -n C-Right select-window -n
bind -n M-S-Left swap-window -t -1
bind -n M-S-Right swap-window -t +1
bind C-a select-window -l
# Fix ERROR: readlink /data/docker/overlay2/l/7M5EN7M5OUETAW42LC63NZBNJA: no such file or directory errors
docker image ls | while read row; do
image_id=$(echo $row | sed -E 's/^(\S+\s+){2}(\S+).*/\2/')
docker inspect --format='{{.GraphDriver.Data.MergedDir}}' $image_id || \
(echo -e "Broken image:\n$row"; echo docker image rm $image_id)
done
@tbnorth
tbnorth / uptag.py
Created June 14, 2022 13:04
Update tags file based on paths in tags file
#!/usr/bin/env python
"""Scans file to find folders on which ctags was originally run."""
import subprocess
from pathlib import Path
dirs = set()
for line in Path("tags").open():
if line.startswith("!"):
continue
# extract 'tests' from
"""Three ways to read data from a stream.
Suggested input:
one
three
END
one
three
END
@tbnorth
tbnorth / partialize.py
Last active January 26, 2022 20:52
Possibly useless partial / delayed execution Python experiment
from functools import partial, wraps, update_wrapper
from time import sleep
def partialize(func):
@wraps(func)
def _partial(*args, **kwargs):
part = partial(func, *args, **kwargs)
update_wrapper(part, func)
return part
@tbnorth
tbnorth / er.sh
Last active December 5, 2021 16:06
With gnu screen and vim turn terminal content into quickfix list and open in running vim (Python Traceback)
screen -X hardcopy $HOME/.tmp.err
sed 's/^ File "//; s/", line /:/; s/,.*/: -/' < $HOME/.tmp.err > $HOME/.tmp.cop
vim --remote-send '<Esc>:cexpr system("cat $HOME/.tmp.cop") | copen<CR>G'
screen -X select "vim --servername VIM"
@tbnorth
tbnorth / movewin.py
Created July 24, 2021 15:54
Relocate Windows 10 windows with Python script
"""Restore window layout in Windows 10
One way of launching, git bash script .sh file:
eval "$('/c/Users/username/pkg/miniconda/Scripts/conda.exe' 'shell.bash' 'hook')"
python "C:/Users/username/scripts/movewin.py"
"""
import win32gui
import re
POSITIONS = [
@tbnorth
tbnorth / gtp
Created March 1, 2021 17:27
git repo based file transfer
#!/bin/bash
# gtp put branch files
# gtp list
# gtp get # last branch
# gtp get branch
REPO=$HOME/gtp_repo
to_branch_name () {
#!/usr/bin/env python3
"""Create a repo auto_{dirname} on GitHub and add it as a remote for the
current repo. called 'auto'.
Expects GITHUB_USER and GITHUB_TOKEN in ~/.gh_auto:
GITHUB_USER = "gituser"
GITHUB_TOKEN = "647e67457e8e5e49ba56583fb6623cf0"
"""
import json
import os
import subprocess