Skip to content

Instantly share code, notes, and snippets.

View robert-nix's full-sized avatar

Robert Nix robert-nix

View GitHub Profile
@robert-nix
robert-nix / decode_shc.py
Last active November 29, 2021 17:49
convert a smart health card url to JSON
# Decode Smart Health Card URL
import argparse
import base64
import json
import zlib
from urllib.parse import urlparse
parser = argparse.ArgumentParser(description='Decode Smart Health Card URL')
parser.add_argument('url', help='URL to decode')
import * as matrix from './matrix';
import * as vec from './vec';
test.each([
[
matrix.as<3, 2>([
[1,2,3],
[4,5,6]
] as const),
@robert-nix
robert-nix / FastHashMap.cs
Last active June 17, 2018 14:52
Unity ECS implementation of bytell_hash_map
using System;
using System.Collections;
using System.Collections.Generic;
#if FAKE_UNSAFE_UTILITY
using System.Runtime.InteropServices;
#else
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
#endif
@robert-nix
robert-nix / DictionaryExample.cs
Last active December 18, 2017 06:37
DEFLATE using a preset dictionary with SharpZipLib (and the equivalent zlib code)
using System;
using System.IO;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Checksums;
public class DictionaryExample
{
Inflater m_inflater;
void InitInflater()

Keybase proof

I hereby claim:

  • I am mischanix on github.
  • I am mischanix (https://keybase.io/mischanix) on keybase.
  • I have a public key whose fingerprint is 55A4 176A BF08 D545 71D3 42F9 D1F6 EFA8 09D5 A56A

To claim this, I am signing this object:

@robert-nix
robert-nix / crc_brute.go
Created August 13, 2017 21:39
CRC guesser
package main
import (
"bytes"
"encoding/csv"
"errors"
"flag"
"fmt"
"hash/crc32"
"io"
@robert-nix
robert-nix / Inject.cpp
Last active April 17, 2019 08:05
Unity 5.5.2f1 type information
// A quick and dirty DLL injector
// This method relies on static linkage and the fact that kernel32 doesn't move
// Compile with the same bitness as the target and the dll.
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <Psapi.h>
#include <stdio.h>
int GetPid(char *modName)
{
/*
* decoder for DXTn-compressed data
*
* Format documentation:
* http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt
*
* The contents of this file are in the public domain (CC0)
* Full text of the CC0 license:
* https://creativecommons.org/publicdomain/zero/1.0/
*
// lib /def:user32.def
// cl /O2 test.cpp /link user32.lib
#include <Windows.h>
#include <stdio.h>
struct PrecisionTouchPadConfig {
BYTE LegacyParams[3];
BOOL LoadedSettings;
// 0: No delay (always on)
ts = [(0, 'm[1:0],g2[4],b2[4],b3[4],r0[9:0],g0[9:0],b0[9:0],r1[4:0],g3[4],g2[3:0],g1[4:0],b3[0],g3[3:0],b1[4:0],b3[1],b2[3:0],r2[4:0],b3[2],r3[4:0],b3[3]'),
(1, 'm[1:0],g2[5],g3[4],g3[5],r0[6:0],b3[0],b3[1],b2[4],g0[6:0],b2[5],b3[2],g2[4],b0[6:0],b3[3],b3[5],b3[4],r1[5:0],g2[3:0],g1[5:0],g3[3:0],b1[5:0],b2[3:0],r2[5:0],r3[5:0]'),
(2, 'm[4:0],r0[9:0],g0[9:0],b0[9:0],r1[4:0],r0[10],g2[3:0],g1[3:0],g0[10],b3[0],g3[3:0],b1[3:0],b0[10],b3[1],b2[3:0],r2[4:0],b3[2],r3[4:0],b3[3]'),
(6, 'm[4:0],r0[9:0],g0[9:0],b0[9:0],r1[3:0],r0[10],g3[4],g2[3:0],g1[4:0],g0[10],g3[3:0],b1[3:0],b0[10],b3[1],b2[3:0],r2[3:0],b3[0],b3[2],r3[3:0],g2[4],b3[3]'),
(10, 'm[4:0],r0[9:0],g0[9:0],b0[9:0],r1[3:0],r0[10],b2[4],g2[3:0],g1[3:0],g0[10],b3[0],g3[3:0],b1[4:0],b0[10],b2[3:0],r2[3:0],b3[1],b3[2],r3[3:0],b3[4],b3[3]'),