Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
@rcoup
rcoup / .gammurc
Last active March 31, 2026 02:12
Gammu config and script for receiving SMS via a USB modem attached to an OSX computer and forwarding it into iMessage, where it will appear on all your devices.
[gammu]
port = /dev/tty.HUAWEIMobile-Modem
connection = at19200
model = at
synchronizetime = yes
logfile = /Users/me/.gammu/log
logformat = errorsdate
gammucoding = utf8
[smsd]
@rcoup
rcoup / aws_usage.py
Created June 1, 2010 21:46
A script to query the Amazon Web Services (S3/EC2/etc) usage reports programmatically.
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
@rcoup
rcoup / blocksync.py
Last active June 1, 2025 09:51
Block device sync between remote hosts. Based off http://www.bouncybouncy.net/programs/blocksync.py
#!/usr/bin/env python
"""
Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff <justin@bouncybouncy.net>
Copyright 2011 Robert Coup <robert@coup.net.nz>
License: GPL
Getting started:
@rcoup
rcoup / rsync_parallel.sh
Created April 10, 2013 21:52
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@rcoup
rcoup / .gitignore
Last active October 17, 2023 15:14
PROJ in a browser demo via Enscriptem+WASM
/proj
/proj-build
/sqlite
/sqlite-amalgamation-*.zip
/one-native
/one-native.dSYM
/one.data
/one.html
/one.js
/one.wasm
@rcoup
rcoup / cloc.sh
Created September 20, 2023 10:09
Simple bash script to run cloc across a big pile of repositories
#!/bin/bash
set -euo pipefail
# simple repo cloc report
# * ignores submodules
GIT_REMOTE="git@github.com:myorg"
REPOS=(
myfirstrepo
mysecondrepo
@rcoup
rcoup / test_vsi.py
Created August 16, 2023 09:25
GDAL VSI Python file wrappers and associated IO functions, and tests.
"""
Tests for VSI-File
Copyright Koordinates Limited
License MIT
"""
import io
import logging
import os
@rcoup
rcoup / elf-validate.sh
Created April 24, 2023 18:51
ELF binary validation script
#!/bin/bash
set -eu
command -v eu-elflint >/dev/null || (echo "eu-elflint not found, install elfutils"; exit 1)
command -v scanelf >/dev/null || (echo "scanelf not found, install pax-utils"; exit 1)
BINARIES=$(scanelf -EET_EXEC -RBF %F "${1-.}")
ERRS=0
for BINARY in $BINARIES; do
@rcoup
rcoup / conftest.py
Created June 27, 2019 15:02
Click CliRunner with PDB working better under pytest
import contextlib
import io
import warnings
import pytest
from click.testing import CliRunner
"""
In your tests:
@rcoup
rcoup / Dockerfile
Last active August 31, 2021 12:47
Docker container for SWIG. Helpful when you need a specific version to avoid massive diffs.
# Usage
#
# To build:
# $ docker build --build-arg SWIG_VERSION=3.0.10 -t swig .
#
# To run:
# host$ docker run --rm -it -v $(pwd):/src swig
# cont$ swig ...
#
# For SWIG 4.x use bullseye, for 3.x use buster