Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Jonathan Dickinson jcdickinson

:shipit:
View GitHub Profile
@jcdickinson
jcdickinson / fix-aoe4.sh
Last active Apr 2, 2022
AOE4 Desync Fix
View fix-aoe4.sh
#!/usr/bin/env bash
set -e
STEAM_DIR=$HOME/.steam/steam/steamapps
if [ ! -e "$STEAM_DIR" ]; then
# Possibly flatpak
STEAM_DIR=/var/home/$USER/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps
fi
View machine.js
const fetchMachine = Machine({
initial: "init",
context: {
element: null,
pointerId: 0,
startX: 0,
startY: 0,
transform: null,
},
invoke: {
View machine.js
const fetchMachine = Machine({
initial: "dragging",
context: {},
entry: "log",
states: {
dragging: {
on: {
pointerup: "drop",
pointermove: {
View machine.js
const fetchMachine = Machine({
initial: "dragging",
context: {},
entry: () => console.log("started"),
states: {
dragging: {
on: {
pointerup: "drop"
View machine.js
const DragMachine = null;
const fetchMachine = Machine({
id: "exampleParent",
initial: "idle",
context: {
x: 0,
y: 0,
},
@jcdickinson
jcdickinson / LICENSE
Last active Jun 30, 2021
XState Drag/Drop
View LICENSE
Copyright 2021 Jonathan Dickinson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O
View Parse.cpp
// Does not reject invalid data. define NO_OVERFLOW to avoid values
// larger than 15, but it will still accept invalid characters.
// MSN(x) = Most-significant nibble
// LSN(x) = Least-significant nibble
// SHL(x, y) = Shift left
// SHR(x, y) = Shift right
// MSN(Digits) = 0011
// MSN(Upper) = 0100
@jcdickinson
jcdickinson / Add.asm
Last active Nov 4, 2017
The Curious Case of the 1814 Byte Method
View Add.asm
; Assembly listing for method System.HashCode:Test_1():int
; Emitting BLENDED_CODE for X64 CPU with AVX
; optimized code
; rsp based frame
; partially interruptible
; Final local variable assignments
;
; V00 loc0 [V00 ] ( 29, 11 ) struct (32) [rsp+0x30] do-not-enreg[XSFB] must-init addr-exposed ld-addr-op
; V01 tmp0 [V01,T00] ( 3, 6 ) int -> rcx
; V02 tmp1 [V02,T08] ( 5, 2 ) int -> rcx
View razerngen.ps1
$InstallDir = 'C:\Program Files (x86)\Razer'
Get-ChildItem -Path $InstallDir -Filter '*.dll' -Recurse | ForEach-Object {
$Assembly = $_.FullName
Write-Host "Queueing up $Assembly for NGEN installation."
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install $Assembly /queue:2 /nologo
}
Get-ChildItem -Path $InstallDir -Filter '*.exe' -Recurse | ForEach-Object {
@jcdickinson
jcdickinson / forward.bat
Created Jan 25, 2017
Forward Azure Storage Emulator
View forward.bat
netsh interface portproxy add v4tov4 listenport=20000 connectaddress=127.0.0.1 connectport=10000 protocol=tcp
netsh interface portproxy add v4tov4 listenport=20001 connectaddress=127.0.0.1 connectport=10001 protocol=tcp
netsh interface portproxy add v4tov4 listenport=20002 connectaddress=127.0.0.1 connectport=10002 protocol=tcp
REM Your connection string will be similar to:
REM DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
REM AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
REM BlobEndpoint=http://192.168.0.2:20000/devstoreaccount1;
REM TableEndpoint=http://192.168.0.2:20002/devstoreaccount1;
REM QueueEndpoint=http://192.168.0.2:20001/devstoreaccount1;