Skip to content

Instantly share code, notes, and snippets.

View fortinmike's full-sized avatar

Michaël Fortin fortinmike

View GitHub Profile
@fortinmike
fortinmike / reclaim-disk-space.bat
Last active October 26, 2024 16:50
Aggressively reclaim disk space in a Windows partition
::
:: Reclaims Windows disk space in a "destructive" manner (can't uninstall service packs and updates afterwards, etc.).
:: Use at your own risk. Useful for Windows installations in space-constrained environments, such as a small Boot Camp
:: partition on a Mac.
::
:: [IMPORTANT] It is strongly suggested to make a full-disk backup of your Windows partition before running this script,
:: as you can't roll back service packs and updates afterwards.
::
:: [IMPORTANT] Run this script as admin (required to run `Dism.exe` among other things).
::
@fortinmike
fortinmike / up.sh
Last active February 13, 2020 16:13
Transmission (transmission-daemon) + OpenVPN + Private Internet Access (PIA) automatic port forwarding when VPN connects
#!/usr/bin/env bash
# This script sets the Transmission port to a port that is dynamically
# opened by PIA when we access their port forwarding API at 209.222.18.222.
#
# Don't forget to set your Transmission username and password and to
# make this script executable! `$ chmod +x up.sh`
#
# Dependencies:
# - jq (`apt install jq`)
@fortinmike
fortinmike / convert-epub-to-mobi-with-calibre.sh
Created March 5, 2019 14:11
Convert EPUB files and packages to MOBI using the Calibre CLI (the app must be installed)
#!/bin/bash
DIRNAME=$(dirname -- "$1")
BASENAME=$(basename -- "$1")
if [ ! -d "$1" ]; then
# The EPUB is already a file, convert straight away
/Applications/calibre.app/Contents/MacOS/ebook-convert "$1" "$DIRNAME/$BASENAME.mobi"
else
# The EPUB is a directory, convert it to a file before conversion
@fortinmike
fortinmike / CustomVuforiaNativeRendererController.mm
Last active February 10, 2022 22:43
A rough guide on how to embed a Unity view in a native iOS or React Native-based app
// NOTE: Copied and cleaned-up from Unity/Libraries/VuforiaNativeRendererController.mm
// REASON: The .mm file did not expose an interface and categorically overrode the Unity app delegate subclass
// using `IMPL_APP_CONTROLLER_SUBCLASS(VuforiaNativeRendererController)`, preventing us from providing our own
// subclass of `VuforiaNativeRendererController` to serve as the final app delegate. Diff this file with the
// source file (specified above) to view the applied changes.
#import "CustomVuforiaNativeRendererController.h"
#import "VuforiaRenderDelegate.h"
// Unity native rendering callback plugin mechanism is only supported
@fortinmike
fortinmike / json-8.0.json
Last active August 29, 2015 14:23
TeamCity 9.0 build artifact JSON output change
{
"files": [
{
"size": 600176,
"modificationTime": "20150611T140222-0400",
"content": {
"href": "/httpAuth/app/rest/8.0/builds/id:280/artifacts/content/SRC.Elections2015-App-Build47-pdb.zip"
},
"children": {
"href": "/httpAuth/app/rest/8.0/builds/id:280/artifacts/children/SRC.Elections2015-App-Build47-pdb.zip"