Skip to content

Instantly share code, notes, and snippets.

View adituv's full-sized avatar

Iris Ward adituv

View GitHub Profile
@adituv
adituv / bizhawk-shim.lua
Last active February 20, 2024 03:07
Bizhawk shim for VBA-rr lua scripts
-- VBA/Bizhawk shim, to allow lua scripts written for VBA-rr to run in BizHawk.
-- Copy and paste this script into the start of a VBA-rr script to make it run in
-- BizHawk with no further modifications.
-- Changes to BizHawk's built-in tables persist while the lua console window is open.
-- Make sure we don't copy our already-updated objects.
if type(joypad.get) == "userdata" then
bizJoypad = copytable(joypad)
end
@adituv
adituv / README.md
Last active January 9, 2019 16:37
Triple Triad Card Data (Patch 4.5)
@adituv
adituv / Ratio.hs
Created January 26, 2018 01:29
Show ratios as a mixed fraction
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
module Text.Show.Ratio(showMixed, showsMixed, showsPrecMixed) where
import Data.Ratio
-- | Convert a @'Ratio' a@ to a readable string, where the ratio is
-- expressed as a mixed fraction in its simplest form. `showsPrecMixed`
-- is designed for use as part of another show implementation, and so
@adituv
adituv / Text.hs
Created January 4, 2018 07:24
Text to Foundation's String
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
module Foundation.Interop.Text where
import Foundation
import Foundation.Array
import Foundation.Bits
import Foundation.Collection
@adituv
adituv / demoteNat.hs
Created December 4, 2017 03:22
No proxies thanks to -XTypeApplications!
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@adituv
adituv / existentials.idr
Last active September 10, 2024 07:25
Existential types in idris
module Main
import Data.Vect
exists : {k : Type} -> (k -> Type) -> Type
exists t = (b : Type) -> ({a : _} -> t a -> b) -> b
packExists : {k : Type} -> {t : k -> Type} -> {a : k} -> t a -> exists t
packExists x = \b, f => f x
@adituv
adituv / main.cpp
Created February 16, 2017 23:31
SDL Gamepad Input Stuff
#include <cstdio>
#include <string>
#include <vector>
#include <SDL.h>
void logJoystickEvent(SDL_Event e);
std::string showHatState(Uint8 hat);
int main(int argc, char* argv[]) {
// Detect first gamepad on which a key is pressed, then log its events.
@adituv
adituv / main.idr
Created October 23, 2016 22:05
Idris attempt?
module Main
import Data.Vect
toVect : List a -> ( n:Nat ** Vect n a )
toVect Nil = ( 0 ** Nil )
toVect (x :: xs) with (toVect xs)
| (n ** ys) = ( S n ** x :: ys )
listFromString : String -> List Int
@adituv
adituv / tmp_generate_dbg_pak.cs
Last active October 16, 2016 09:36
tmp_generate_dbg_pak
using System;
using System.Collections.Generic;
using System.IO;
namespace tmp_generate_dbg_pak
{
class Program
{
// Generates a stub "dbg.pak.xen" file from a filename checksum listing
// One entry per line in the listing, tab separated. Checksum (no 0x), then the path
@adituv
adituv / .zshrc
Created September 8, 2016 18:23
oh-my-zsh zshrc
# Path to your oh-my-zsh installation.
export ZSH=/home/aditu/.oh-my-zsh
# Configuration for Powerline theme
# Hide context when in this user's context
DEFAULT_USER="aditu"
POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_STATUS_VERBOSE=false