Skip to content

Instantly share code, notes, and snippets.

View bulletmark's full-sized avatar

Mark Blakeney bulletmark

  • Brisbane Australia
View GitHub Profile
@bulletmark
bulletmark / p03
Last active December 6, 2023 22:10
#!/usr/bin/env python3
import math
from dataclasses import dataclass
import fileinput
@dataclass
class NUMBER:
value: int
length: int
coords: tuple[int, int]
@bulletmark
bulletmark / PKGBUILD
Last active August 16, 2023 22:44
Arch Linux patch for mutter 44.3-1 to revert commit 3ac82a58 to fix issue https://gitlab.gnome.org/GNOME/mutter/-/issues/2690
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Michael Kanis <mkanis_at_gmx_dot_de>
# Contributor: Mark Blakeney <mark dot blakeney at bullet dash systems dot net>
pkgbase=mutter
pkgname=(
mutter
)
pkgver=44.3+r0+g99d83f298
@bulletmark
bulletmark / archclean.sh
Created February 26, 2023 23:18
Arch Linux script to clean system
PROGARGS="$*"
JTIME="2weeks"
# First AUR helper found in this list will be used
AURHELPERS="yay paru trizen pacaur"
usage() {
echo "Usage: $(basename $PROG) [options]"
echo "Clean system and user package caches and prune journal."
echo "Options:"
@bulletmark
bulletmark / day04.py
Created December 5, 2021 01:47
AOC 2021 Day 4
#!/usr/bin/python3
import numpy as np
DATA = 'data/day04'
def total(board):
return np.sum(board[board > 0])
def main():
boards = []
@bulletmark
bulletmark / PKGBUILD
Last active February 25, 2022 02:58
borg-standalone-arm-bin
Maintainer: mark.blakeney at bullet-systems dot net
pkgname=borg-standalone-arm-bin
pkgver=1.2.0
pkgrel=1
pkgdesc="Borg backup - prebuilt standalone ARM binary"
url="https://borgbackup.readthedocs.io/en/stable/installation.html#standalone-binary"
license=("BSD")
arch=("armv8h" "armv7h" "armv6h" "armv5h")
replaces=("borg-arm-bin")
provides=("borg" "borgbackup")
@bulletmark
bulletmark / PKGBUILD
Last active August 21, 2022 05:20
borg-standalone-bin
# Maintainer: mark.blakeney at bullet-systems dot net
pkgname=borg-standalone-bin
pkgver=1.2.2
pkgrel=1
pkgdesc="Borg backup - prebuilt standalone binary"
url="https://borgbackup.readthedocs.io/en/stable/installation.html#standalone-binary"
license=("BSD")
arch=("x86_64" "i686")
replaces=("borg-bin")
provides=("borg" "borgbackup")
@bulletmark
bulletmark / wifi-switcher
Last active January 2, 2024 03:06
Small program to switch wifi off/on when wired connection goes on/off
#!/usr/bin/env python3
# If you are using Linux NetworkManager then this program toggles your
# wifi connection off->ON whenever your wired connection goes ON->off,
# and vice-versa. Simply copy this to
# /etc/NetworkManager/dispatcher.d/99-wifi and ensure it is executable.
# No configuration is required. Get the latest version from
# https://gist.github.com/bulletmark/8e051a0a9ffdce689d86988c528e7764
# Author: Mark Blakeney, Jun 2020.
from __future__ import annotations
import subprocess
@bulletmark
bulletmark / sumbench
Created July 4, 2018 07:53
Program to benchmark set of checksum commands
#!/usr/bin/python3
'Program to benchmark set of checksum commands.'
# Author: M.Blakeney, Jul 2018.
import os, argparse, time, tempfile, subprocess, statistics
import collections, platform
# Default set of commands to execute
CMDS = 'md5sum,sha1sum,sha256sum'
@bulletmark
bulletmark / sumbench.sh
Created July 4, 2018 07:39
Script to run given first argument command across given machines
!/bin/bash
# Run given first argument command across given machines
# M.Blakeney, Jul 2018.
script=$1
shift
hosts=$*
bscript=$(basename $script)
for h in $hosts; do
rsync -a $script $h:/tmp/
@bulletmark
bulletmark / gs-extract.sh
Last active September 1, 2023 00:50
Bash script to extract GNOME shell javascript files
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "usage $0 dir" >&2
exit 1
fi
dir="$1"
if [[ -e $dir ]]; then
echo "Error: $dir already exists" >&2