Skip to content

Instantly share code, notes, and snippets.

View cstrahan's full-sized avatar

Charles Strahan cstrahan

  • Fullstory
  • Dallas, TX
View GitHub Profile
@cstrahan
cstrahan / SMBDIS.ASM
Created October 16, 2017 22:51 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@cstrahan
cstrahan / example.go
Created October 5, 2017 20:18 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@cstrahan
cstrahan / example.go
Created October 5, 2017 20:18 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@cstrahan
cstrahan / main.hs
Created October 2, 2017 07:31 — forked from cocreature/main.hs
{-# LANGUAGE MagicHash, UnboxedTuples #-}
module Main(main) where
import GHC.Exts ( addrToAny# )
import GHC.Ptr ( Ptr(..) )
import System.Info ( os, arch )
import Encoding
import ObjLink
main :: IO ()
@cstrahan
cstrahan / bridged.conf
Created August 3, 2017 02:47 — forked from gdamjan/bridged.conf
bridged openvpn with networkd
# /etc/openvpn/bridged.conf
comp-lzo
persist-key
persist-tun
dh /etc/openvpn/dh1024.pem
ca /etc/openvpn/ca.crt
cert /etc/openvpn/bridged.crt
key /etc/openvpn/bridged.key
@cstrahan
cstrahan / Deriv.idr
Created July 20, 2017 07:14 — forked from paf31/Deriv.idr
Calculus of types in idris
module Deriv
import Control.Isomorphism
--
-- A type constructor df is the derivative of the type constructor f if for all x and e there exists d such
-- such that
--
-- f (x + e) ~ f x + e * (df x) + e^2 * d
--
@cstrahan
cstrahan / Main.hs
Created June 12, 2017 19:27 — forked from danidiaz/Main.hs
generics-sop panic
{-# language DeriveGeneric #-}
{-# language FlexibleContexts #-}
{-# language TypeFamilies #-}
{-# language DataKinds #-}
{-# language ScopedTypeVariables #-}
{-# language TypeOperators #-}
{-# language TypeApplications #-}
import Data.List
import qualified GHC.Generics as GHC
#!/bin/bash
# this is a little recipe for using `sudo rsync` on
# old machines that require a tty to call `sudo`.
#
# This prevents errors like:
#
# sudo: sorry, you must have a tty to run sudo
#
# when using rsync with sudo.
package main
import (
"bytes"
"fmt"
"io/ioutil"
"math"
)
const (
@cstrahan
cstrahan / problem.cpp
Created April 3, 2017 03:24 — forked from depp/problem.cpp
A Faster Solution
// Faster solution for:
// http://www.boyter.org/2017/03/golang-solution-faster-equivalent-java-solution/
// With threading.
// g++ -std=c++11 -Wall -Wextra -O3 -pthread
// On my computer (i5-6600K 3.50 GHz 4 cores), takes about ~160 ms after the CPU
// has warmed up, or ~80 ms if the CPU is cold (due to Turbo Boost).
// How it works: Start by generating a list of losing states -- states where the
// game can end in one turn. Generate a new list of states by running the game