Skip to content

Instantly share code, notes, and snippets.

View halfninja's full-sized avatar
🌶️
spicy code

Nick Howes halfninja

🌶️
spicy code
View GitHub Profile
@halfninja
halfninja / ubuntu-dualboot-luks.md
Last active January 10, 2024 18:33
Dual Booting Ubuntu with LUKS2

This guide is based on Mike Kasberg's guide so give thanks to him for the bulk of this. I've just customised for our situation and to avoid having to reinstall the Windows that we are provided with.

Overview

Here's broadly what we'll do:

  1. Disable Bitlocker on Windows
  2. Run the official Ubuntu graphical installer for (unencrypted) dual boot
  3. Delete the Ubuntu partition and replace it with the encrypted partition setup
  4. Install Ubuntu onto these partitions
@halfninja
halfninja / fileToUuid.kt
Created November 9, 2023 10:08
Read a 16-byte file and print as a UUID
import java.io.File
import java.util.UUID
import java.nio.ByteBuffer
fun main(vararg args: String) {
val filename = args.firstOrNull()
if (filename == null) {
System.err.println("Usage: kotlin UuidKt <filename>")
System.exit(1)
}
/** Spread all items approximately equal between recipients. If there is a nonzero remainder N
* between the recipients, the first N recipients will receive an extra one each, so nobody will
* receive more than 1 than anyone else.
*
* Doesn't consider how many items a recipient may already be holding, so it won't seek to
* balance out recipients if they are currently unbalanced.
*
* @return Each recipient with a list of its allotted items
*/
object distribute {
@halfninja
halfninja / dabblet.css
Last active October 20, 2018 20:09
Progress bar that changes width AND color using a CSS variable
/**
* Progress bar that changes width AND color using a CSS variable
*/
div {
display: flex;
height: .8em;
margin: 1em 0;
background: hsl(220,10%,80%);
}
@halfninja
halfninja / dabblet.css
Last active October 20, 2018 19:00
Untitled
**
* attr()
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}
@halfninja
halfninja / dabblet.css
Created October 20, 2018 18:02 — forked from LeaVerou/dabblet.css
Progress bar that changes width AND color using a CSS variable
/**
* Progress bar that changes width AND color using a CSS variable
*/
div {
display: flex;
height: .8em;
margin: 1em 0;
background: hsl(220,10%,80%);
}
@halfninja
halfninja / dabblet.css
Created October 20, 2018 18:02 — forked from LeaVerou/dabblet.css
Progress bar that changes width AND color using a CSS variable
/**
* Progress bar that changes width AND color using a CSS variable
*/
div {
display: flex;
height: .8em;
margin: 1em 0;
background: hsl(220,10%,80%);
}
@halfninja
halfninja / mapper.txt
Created February 16, 2018 21:18
Ultima Underworld 2 DOSBox key mapping for laptop
hand_shutdown "key 290 mod1"
hand_capmouse "key 291 mod1"
hand_fullscr "key 13 mod2"
hand_pause "key 19 mod2"
hand_mapper "key 282 mod1"
hand_speedlock "key 293 mod2"
hand_recwave "key 287 mod1"
hand_caprawmidi "key 289 mod1 mod2"
hand_scrshot "key 286 mod1"
hand_video "key 286 mod1 mod2"
@halfninja
halfninja / create-local-oracle.sh
Created June 5, 2017 13:09
Local Oracle XE instance for development
# create volume container - doesn't run, just holds the data.
docker create \
-v /u01/app/oracle/fast_recovery_area \
-v /u01/app/oracle/oradata \
--name oracle_data \
wnameless/oracle-xe-11g
# run Oracle using the above shared container - you can destroy and recreate this and they
# will share the above data area.
docker run -d \
var crypto = require('crypto');
var fs = require('fs');
const PlayFingerprintsPlugin = function(options) {
this.apply = this.apply.bind(this, options || {});
};
PlayFingerprintsPlugin.prototype.apply = (options, compiler) => {
compiler.plugin('emit', (compilation, done) => {
for (const filename in compilation.assets) {
const hash = crypto.createHash("md5");