Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
rcoup /
Created September 20, 2023 10:09
Simple bash script to run cloc across a big pile of repositories
set -euo pipefail
# simple repo cloc report
# * ignores submodules
rcoup /
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 /
Created April 24, 2023 18:51
ELF binary validation script
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-.}")
rcoup / .gitignore
Last active October 17, 2023 15:14
PROJ in a browser demo via Enscriptem+WASM
rcoup / index.html
Created August 23, 2021 10:34
GeoServer docs root index update. Fix broken header links.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" lang="en-US" xml:lang="en-US">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GeoServer Documentation</title>
<link rel="stylesheet" href="_static/blueprint/screen.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="_static/blueprint/print.css" type="text/css" media="print" />
<!--[if IE]>
rcoup /
Created July 26, 2021 06:47
Python Sequence Join Format String Wrapper
class J:
Sequence Join Format String Wrapper
>>> seq = ['a', 'b', 1, None]
>>> print(f"default: {J(seq)}"
default: 1,b,1,None
>>> print(f"custom-delimeter: {J(seq):/-}"
custom-delimiter: a/-b/-1/-None
rcoup / output.log
Last active February 26, 2021 12:00
Git: partial clone: promisor fetch during push (pack-objects)
+ git --version
git version
+ uname -a
Darwin otata 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,1 Darwin
+ rm -rf ./SK.local.git ./SK.remote.git
+ git clone --bare SK.remote.git
Cloning into bare repository 'SK.remote.git'...
warning: templates not found in /Users/rcoup/share/git-core/templates
remote: Enumerating objects: 16, done.
rcoup / .profile
Created August 8, 2019 08:15
Iterm2 Status Bar stuff
# with Hack from installed
function iterm2_print_user_vars() {
# kubernetes current cluster & namespace
CONTEXT="$(kubectl config current-context)"
if [ -n "$CONTEXT" ]; then
NAMESPACE="$(kubectl config view -o=jsonpath="{.contexts[?(\"${CONTEXT}\")].context.namespace}")"
iterm2_set_user_var kubecontext "⎈ $CONTEXT:${NAMESPACE:-default}"
iterm2_set_user_var kubecontext ""
rcoup /
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 / git_revparse_single.cflow.txt
Created June 27, 2019 12:13
cflow trace for git_revparse_single()
$ cflow -T --brief --main=git_revparse_single refs.c revparse.c
+-git_revparse_single() <int git_revparse_single (git_object **out, git_repository *repo, const char *spec) at revparse.c:854>
+-git_revparse_ext() <int git_revparse_ext (git_object **object_out, git_reference **reference_out, git_repository *repo, const char *spec) at revparse.c:828>
| +-revparse__ext() <int revparse__ext (git_object **object_out, git_reference **reference_out, size_t *identifier_len_out, git_repository *repo, const char *spec) at revparse.c:663>
| | +-assert()
| | +-ensure_base_rev_loaded() <int ensure_base_rev_loaded (git_object **object, git_reference **reference, const char *spec, size_t identifier_len, git_repository *repo, bool allow_empty_identifier) at revparse.c:610>
| | | +-object_from_reference() <int object_from_reference (git_object **object, git_reference *reference) at revparse.c:596>
| | | | +-git_reference_resolve() <int git_reference_resolve (git_reference **ref_out, const git_reference *ref) at ref