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 / gist:23e9f2419d5ac3e587dabeee97fabb42
Created September 18, 2018 22:58
Issue where sometimes the container doesn't exit
$ docker run --volume "${PWD}:/home/tester/core" debianimage ps aux
Starting Xvfb...
Started Xvfb with PID 8
Running command: ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 3.0 0.0 21672 3256 ? Ss 08:57 0:00 /bin/bash /home/tester/run-wrapper ps aux
root 8 0.0 0.0 19424 876 ? R 08:57 0:00 Xvfb :1 -screen 0 1024x768x24
root 9 0.0 0.0 19104 2560 ? R 08:57 0:00 ps aux
Finished
Stopping Xvfb...
@hakanai
hakanai / blah.txt
Last active September 14, 2018 02:23
Some BMP format stuff
BMP file
{
42 4d - magic 'BM'
8e 00 00 00 - total file size
00 00 00 00 - application specific reserved stuff
8a 00 00 00 - offset to pixel array
DIB header (BITMAPV5HEADER)
{
7c 00 00 00 - DWORD biSize = 0x7c (bytes in header from here)
@hakanai
hakanai / blah.txt
Created September 14, 2018 00:02
Some PNG related stuff
00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR|
00000010 00 00 00 01 00 00 00 01 08 06 00 00 00 1f 15 c4 |................|
00000020 89 00 00 00 0d 49 44 41 54 78 da 63 98 f5 f9 7b |.....IDATx.c...{|
00000030 34 00 07 8f 02 e0 a7 82 a8 9a 00 00 00 00 49 45 |4.............IE|
00000040 4e 44 ae 42 60 82 |ND.B`.|
00000046
89 50 4e 47 0d 0a 1a 0a - magic
@hakanai
hakanai / TestIreland.java
Last active July 17, 2018 04:29
Welcome to in Ireland, the only country where the clock is turned _back_ for daylight saving time.
import java.util.Locale;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.TimeZone;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.junit.Test;
@hakanai
hakanai / clock.html
Created July 6, 2018 07:11
Attempt at improving @y23586's clock to use time zones properly. Supports less stuff overall, though.
<!doctype html>
<html>
<head>
<style type="text/css">
html, body {
height: 100%;
width: 100%;
padding: 0px;
margin: 0px;
@hakanai
hakanai / ThickGlass.cginc
Created June 30, 2018 07:17
Quick implementation of the first step documented in http://prideout.net/blog/?p=51
#include "UnityCG.cginc"
fixed4 _Color;
float _DepthScale;
float _Sigma;
struct VertexInput
{
float3 objectPos : POSITION;
@hakanai
hakanai / aabb-ray-intersect.cginc
Last active June 17, 2018 12:54
AABB-Ray intersect returning which side was hit (wrong logic)
uint faceIndexFromDirection(float3 worldViewPos, float3 worldViewDir)
{
//todo carry these from the source
float3 objectViewPos = mul(unity_WorldToObject, float4(worldViewPos, 1)).xyz;
float3 objectViewDir = mul(unity_WorldToObject, float4(worldViewDir, 0)).xyz;
fixed3 directionSign = sign(objectViewDir);
float3 directionInverse = 1.0 / objectViewDir;
float3 xHit = (-directionSign.x - objectViewPos.x) * directionInverse.x * objectViewDir;
@hakanai
hakanai / apfs_allocation.txt
Created June 15, 2018 00:26
APFS allocation examples
For a 256-block image: (I see the same for 246-block images)
1 block for main (current checkpoint's) container superblock
8 blocks for previous checkpoints and container superblocks
52 blocks for space manager and related objects
16 blocks for future expansion?
6 blocks for allocation info file blocks
------
83
@hakanai
hakanai / acls.txt
Last active June 13, 2018 23:15
APFS XAttr com.apple.system.Security
APFS XAttr com.apple.system.Security
====================================
Original command I ran:
chmod +a 'group:staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit' file
Resulting xattr:
@hakanai
hakanai / VideoUpdater.cs
Created June 2, 2018 03:00
VRC_SyncVideoPlayer updater script that runs in Unity. Currently very tied to loading my own database from YAML and updating a video player and a separate component with a list of videos in it, but modify as you wish.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.Video;
using VRCSDK2;
using YamlDotNet.RepresentationModel;