Skip to content

Instantly share code, notes, and snippets.

Avatar

Michaël Fortin fortinmike

View GitHub Profile
@fortinmike
fortinmike / reclaim-disk-space.bat
Last active Jan 5, 2021
Aggressively reclaim disk space in a Windows partition
View reclaim-disk-space.bat
::
:: 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 Feb 13, 2020
Transmission (transmission-daemon) + OpenVPN + Private Internet Access (PIA) automatic port forwarding when VPN connects
View up.sh
#!/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 Mar 5, 2019
Convert EPUB files and packages to MOBI using the Calibre CLI (the app must be installed)
View convert-epub-to-mobi-with-calibre.sh
#!/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 Oct 7, 2020
A rough guide on how to embed a Unity view in a native iOS or React Native-based app
View CustomVuforiaNativeRendererController.mm
// 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 Aug 29, 2015
TeamCity 9.0 build artifact JSON output change
View json-8.0.json
{
"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"