Skip to content

Instantly share code, notes, and snippets.

View rjocoleman's full-sized avatar

Robert Coleman rjocoleman

  • Christchurch, New Zealand
View GitHub Profile
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
BRANCH="16.0" # Branch name
REMOTE="origin" # Remote name
CHUNK_SIZE=900
# Get the total number of commits in the branch
TOTAL_COMMITS=$(git rev-list --count $BRANCH)
From b4ddd1a6d0faf0162f00f3dd80516e62c434523e Mon Sep 17 00:00:00 2001
From: Robert Coleman <github@robert.net.nz>
Date: Sun, 4 Dec 2022 22:05:59 +1300
Subject: [PATCH] support db config via database url
---
src/DbDumperFactory.php | 5 +++++
tests/DbDumperFactoryTest.php | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
@rjocoleman
rjocoleman / lenovo-EM7565-upgrade-unlock-qmi.md
Last active September 13, 2022 03:06
My notes upgrading, unlocking and making a Lenovo branded Sierra Wireless EM7565 usable in mainline Linux. Includes PID change, FCC Auth Disable.

Pre-reqs are linux, libqmi and libqmi-utils. The modem connected via USB (USB 2.0 if you have issues connecting)

My modem came up as 1199:90c3 (Lenovo PID), this is not supported by mainline Linux kernel.

To enable the kernel drivers to pick it up and allow me to see the serial interface:

$ modprobe option
$ echo 1199 90c3 > /sys/bus/usb-serial/drivers/option1/new_id
@rjocoleman
rjocoleman / change_use_mac_fileprovider.py
Last active July 13, 2022 11:14 — forked from emersonford/change_gdrive_smb_port.py
Python script to rewrite the `use_mac_fileprovider` setting for Google Drive to true to enable File Provider.
#!/usr/bin/env python3
# see https://apple.stackexchange.com/questions/420959/spotlight-indexing-of-google-drive-file-stream-disabled-on-restart/424445#424445 for an explanation
# based on https://gist.github.com/emersonford/85cc74f7f90c81d1b75c3c246124591d
import os
from copy import deepcopy
from math import log
from pathlib import Path
DEBUG = 0
@rjocoleman
rjocoleman / dokku-env-file.sh
Last active June 6, 2022 00:52
Set Dokku environment variables in bulk from a .env file. assumed to run from the application directory
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
env_file=${1:-}
if [[ -z "$env_file" ]]; then
echo -e "usage: $0 env_file"
exit 1
fi
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
owner_repo=${1:-}
state=${2:-}
environment=${3:-}
if [[ -z "$owner_repo" || -z "$state" || -z "$environment" ]]; then
echo -e 'WARNING: this will delete and overwrite stuff without asking for permission, and no backup is provided. Continue at your own risk'
echo -e 'This script overwrites environment name and state for deployments, 100 at a time. It then attempts to delete the deployment.'
@rjocoleman
rjocoleman / router.php
Last active November 15, 2021 22:56
Mautic 4.x router for built-in php webserver
<?php
## Development router for built-in PHP webserver
require __DIR__ . '/autoload.php';
## using Sparie\Url\Url to avoid the query string (such as cache busting)
## without having to monkey around with parse_url and $_SERVER['REQUEST_URI']
## assumes `composer require --dev spatie/url`
use Spatie\Url\Url;
$url = Url::fromString($_SERVER['REQUEST_URI']);
@rjocoleman
rjocoleman / README.md
Created July 29, 2021 12:19
Stomp on OpenSSH macOS

What?

Replace the macOS ssh-agent with Homebrews.

Why?

For greater control e.g. supporting security keys.

How?

To symlink SSH_AUTH_SOCK on boot to system-wide switch the value from default ssh agent:

  1. Change /opt/homebrew/ to the correct homebrew path (/opt/homebrew is for Apple Silicon and /usr/local for x86)
  2. Change the ssh agent as needed, this example uses https://github.com/FiloSottile/yubikey-agent
  3. Save as ~/Library/LaunchAgents/link-ssh-auth-sock.plist
  4. Run launchctl load -F ~/Library/LaunchAgents/link-ssh-auth-sock.plist

Technique taken from: https://evilmartians.com/chronicles/stick-with-security-yubikey-ssh-gnupg-macos

// ==UserScript==
// @name Reddit default to global geo filter
// @description Use geo_filter=GLOBAL by default
// @namespace https://gist.github.com/rjocoleman/a791033a7edfd0d084d07c73e62e8a2f/raw/f5bff6c051cf48e04352bea8c17919eba05ec0ea/reddit-global.user.js
// @version 0.1.0
// @author rjocoleman
// @license MIT
// @released 2021-02-19
// @updated 2021-02-19
// @match *://www.reddit.com/*