Skip to content

Instantly share code, notes, and snippets.

View mattyclarkson's full-sized avatar

Matt Clarkson mattyclarkson

View GitHub Profile
@mattyclarkson
mattyclarkson / 0001-automake-1.16.5-relocatable
Created October 17, 2022 15:12
A patch to make Automake 1.16.5 relocatable which is especially useful for Conan packaging.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matthew Clarkson <redacted@noware.com>
Date: Wed, 1 Jan 3000 00:00:00 +0000
Subject: [PATCH] Make scripts relocatable
---
Makefile.in | 2 ++
bin/aclocal.in | 7 ++++---
bin/automake.in | 3 ++-
lib/Automake/Config.in | 3 ++-
@mattyclarkson
mattyclarkson / 0001-autoconf-2.71-make-binaries-relocatable.patch
Created October 14, 2022 16:46
A patch for making autoconf 2.71 relocatable. It uses absolute paths in each of the binary scripts. This uses Perl `FindBin::Bin` to use relative paths.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Matt Clarkson <redacted@noware.com>
Date: Wed, 1 Jan 3000 00:00:00 +0000
Subject: [PATCH] refactor: make binaries relocatable
Uses the binary locations and relative paths to the
package data directory to avoid having absolute paths
baked into the binary scripts.
---
Makefile.in | 2 ++
@mattyclarkson
mattyclarkson / safe-directory.sh
Last active June 15, 2022 10:25
A shell script to add `safe.directory` to a `.gitconfig`
#!/bin/sh
# Usage: ./safe-directory.sh directory [.gitconfig] [dst]
#
# `git` will throw permission errors when a repository has been cloned with a
# user different to the runtime user. This script allows adding the cloned
# repository to the `safe.directory` configuration variable without the need
# for an installed `git` binary.
#
# This can be useful on CI runners, when the repository has been cloned as the
# `root` user but the build runs inside a container that has a user different
@mattyclarkson
mattyclarkson / download.py
Created January 7, 2022 12:13
A Python download script for downloading, verifying and unpacking an archive.
#!/usr/bin/env python3
from __future__ import annotations
import hashlib
import tarfile
from inspect import signature
from logging import getLogger, Logger, basicConfig
from binascii import hexlify
@mattyclarkson
mattyclarkson / change-id.js
Created January 26, 2021 15:12
A husky hook to add `Change-Id` to commit messages
/*
"husky": {
"hooks": {
"commit-msg": "node change-id.js -E HUSKY_GIT_PARAMS"
}
},
*/
const [,, arg, key] = process.argv
@mattyclarkson
mattyclarkson / template.sh
Created November 29, 2019 18:09
POSIX sh boilerplate
#!/bin/sh
# # The MIT License (MIT)
#
# Copyright © 2019 **Tub Technology** _<licence@tub.technology>_
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the “Software”), to deal in the Software without
# restriction, including without limitation the rights to use,
@mattyclarkson
mattyclarkson / mingw.py
Created May 29, 2015 13:49
A MinGW-builds download script
#! /usr/bin/env python
# encoding: utf-8
import argparse
import errno
import logging
import os
import platform
import re
import sys
@mattyclarkson
mattyclarkson / commands
Created April 2, 2015 22:33
Systemd Volatile Guest Account
useradd -m guest
chown guest:root /home/guest
chmod -w /home/guest
userdel guest
useradd -d /mnt/guest guest
passwd --delete guest
@mattyclarkson
mattyclarkson / cpplint.py
Created October 16, 2013 15:43
cpplint with support for Python3
#!/usr/bin/python
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@mattyclarkson
mattyclarkson / git.cmd
Last active December 23, 2015 00:19
A BATCH script to start ssh-agent with msysgit, which stops git asking for your ssh passphrase all the time!
@echo off
verify other 2>nul
setlocal EnableDelayedExpansion
if not %ERRORLEVEL% equ 0 (
echo Unable to enable extensions
goto failure
)
rem Start the ssh-agent if needed by git
for %%i in ("git.exe") do set GIT=%%~$PATH:i