Skip to content

Instantly share code, notes, and snippets.

View freemo's full-sized avatar

Jeffrey Phillips Freeman freemo

View GitHub Profile
@freemo
freemo / Explicit
Last active November 11, 2025 20:16
Review the current unit test coverage report at `build/coverage.xml` and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improve coverage on file `$$FILE_PATH$$` by writing tests that will target the uncovered lines in the report.
class ImmutableMeta(ElementMeta):
def __new__(cls, name, bases, namespace, **kwargs):
def my_setattr(self, name, value):
if hasattr(self, "_immutable") and self._immutable and not name.startswith("__"):
raise AttributeError("this class was set immutable can not set %s, %s" % (name, self))
return object.__setattr__(self, name, value)
namespace["__setattr__"] = my_setattr
def my_freeze(self):
self._immutable = True
@freemo
freemo / compile.sh
Last active November 2, 2025 17:00
git clean -xdf && cp -r ../include/ . && mkdir -p m4 && aclocal --force && libtoolize --force --copy && automake --foreign --add-missing --copy --force && autoconf --force && CC=clang ./configure --target=windows-shared-x64 && CC=clang make && ls .libs
git clean -xdf && cp -r ../include/ . && mkdir -p m4 && aclocal --force && libtoolize --force --copy && automake --foreign --add-missing --copy --force && autoconf --force && docker run --rm aparapi/aparapi-toolchain-win64 > dockcross && chmod +x dockcross && ./dockcross ./configure --host=x86_64 --target=windows-shared-x64 && ./dockcross make && ls .libs
@freemo
freemo / script
Last active October 22, 2023 11:58
Backup script usint btrfs
#!/bin/bash
TIMESTAMP=$(date +%F_%R)
OLD_TIMESTAMP="$1"
echo "new timestamp is $TIMESTAMP"
echo "old time is $OLD_TIMESTAMP"
if [ -z "$OLD_TIMESTAMP" ]
then
@freemo
freemo / Script
Last active October 30, 2025 22:25
BTRFS change writability
btrfs property set -ts /path/to/snapshot ro false
btrfs property set -ts /path/to/snapshot ro true
@freemo
freemo / script
Last active October 30, 2025 22:25
Get the boot up dmesg output for a previous boot.
#list all boot-id
journalctl --list-boots
#display dmesg for specific boot-id
journalctl -b <boot-id>
@freemo
freemo / script
Last active October 30, 2025 22:25
Backing up with btrfs
sudo mount /mnt/backup #this should be a btrfs volume
sudo btrfs subvolume snapshot -r / /mnt/backups/root-backup-$(date +%F_%R)
#list all other subvolumes
sudo btrfs subvolume list -p /
#repeat for all subvolumes
sudo btrfs subvolume snapshot -r /home /mnt/backups/home-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /etc /mnt/backups/etc-backup-$(date +%F_%R)
sudo btrfs subvolume snapshot -r /var /mnt/backups/var-backup-$(date +%F_%R)
@freemo
freemo / script
Last active October 30, 2025 22:26
Check listening ports with process on OSX
lsof -Pn -i -sTCP:LISTEN
@freemo
freemo / Bring up container aws-cli
Last active November 6, 2025 18:02
QOTO on AWS
aws ecs register-task-definition --family load-balancer --network-mode bridge --container-definitions "$(cat container-def.json)" --volumes "$(cat volumes-def.json)"
# Launch ECS task, when above command ran once X == 1, for every update X increases by one.
# will have too double check docs how to get latest
aws ecs run-task --cluster default --task-definition load-balancer:X --count 1