Skip to content

Instantly share code, notes, and snippets.

View hakanai's full-sized avatar
⚔️
Battling i16n demons

Hakanai hakanai

⚔️
Battling i16n demons
View GitHub Profile
@hakanai
hakanai / 8dot3-checksum.c
Last active May 24, 2018 01:39
Checksum used by Windows when generating 8.3 filenames. Dredged out of a now-deleted article which can only be found on the Wayback Machine. https://web.archive.org/web/20150610125659/https://usn.pw/blog/gen/2015/06/09/filenames/
/* A checksum calculator for Windows 8.3 filenames.
* The relevant post can be found at http://usn.pw/blog/cs/2015/06/09/filenames/
* Written by Thomas Galvin. */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
uint16_t chksum(wchar_t * name)
@hakanai
hakanai / 8dot3-checksum.c
Created May 24, 2018 01:27
Checksum used by Windows when generating 8.3 filenames. Dredged out of a now-deleted article which can only be found on the Wayback Machine.
/* A checksum calculator for Windows 8.3 filenames.
* The relevant post can be found at http://usn.pw/blog/cs/2015/06/09/filenames/
* Written by Thomas Galvin. */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
uint16_t chksum(wchar_t * name)
@hakanai
hakanai / decoded.txt
Created May 3, 2018 01:23
Message on the wall in Big Sister's
This is an automated message generated by Big Brother,
Mom... Dad, this is my last message to you... I love you both... But you leave me no choice, you took away my pride, happiness... What do you expect me to do?
When the new child is born I shall take way everything you love...
@hakanai
hakanai / Some APFS file attribute structures.txt
Created April 4, 2018 05:08
Some APFS file attribute structures
Some directory:
01 00 00 00 00 00 00 00 parent node ID
02 00 00 00 00 00 00 00 our node ID
12 13 b0 25 44 1a 22 15 time created
29 28 23 65 45 1a 22 15 time modified
29 28 23 65 45 1a 22 15 time changed
12 13 b0 25 44 1a 22 15 time accessed
00 80 00 00 00 00 00 00 0x8000 = flags
@hakanai
hakanai / fbx.ksy
Created March 12, 2018 09:02
Non-working Kaitai Struct definition for FBX format
meta:
id: fbx
title: FBX 3D model interchange format
file-extension: fbx
encoding: UTF-8
endian: le
license: WTFPL
seq:
- id: header
@hakanai
hakanai / MakeStencilScannerGrid.java
Last active February 3, 2018 05:03
Generates a hex grid image
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class MakeStencilScannerGrid {
@hakanai
hakanai / OU3DScreen.shader
Last active May 3, 2019 08:31
Shaders to render 3D images and video (example of unity_StereoEyeIndex)
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "3D/OU3DScreen"
{
Properties
{
[HideInInspector] __dirty( "", Int ) = 1
_MainTex("MainTex", 2D) = "white" {}
[Toggle]_ToggleSwitch2("Toggle Switch2", Float) = 0
}
@hakanai
hakanai / make_cube.rb
Last active January 31, 2018 05:33
Quick and dirty .obj/.mtl generation in Ruby
#!/usr/bin/env ruby
require_relative 'obj'
obj = Obj.build('cube') do
# More about material properties here:
# https://en.wikipedia.org/wiki/Wavefront_.obj_file
# http://www.fileformat.info/format/material/
material = material('cube',
@hakanai
hakanai / HairAccessory.scad
Created January 30, 2018 02:19
Basic example of how to model Miku's hair accessories in OpenSCAD
color([0,0,0,1]) {
difference() {
cube([10,10,1], true);
cube([8,8,1.1], true);
for (i = [0:90:270]) {
rotate([0,0,i]) {
translate([4.8,0,0]) {
cube([0.6,11,1/3], true);
}
Shader "Pixelate" {
Properties {
_CellSize ("Cell Size", Vector) = (0.02, 0.02, 0, 0)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
GrabPass { "_PixelationGrabTexture"}