Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Strahan cstrahan

View GitHub Profile
View HRecursionSchemes.hs
{-# LANGUAGE StandaloneDeriving, DataKinds, PolyKinds, GADTs, RankNTypes, TypeOperators, FlexibleContexts, TypeFamilies, KindSignatures #-}
-- http://www.timphilipwilliams.com/posts/2013-01-16-fixing-gadts.html
module HRecursionSchemes where
import Control.Applicative
import Data.Functor.Identity
import Data.Functor.Const
import Text.PrettyPrint.Leijen hiding ((<>))
@cstrahan
cstrahan / IxFix.hs
Created Nov 26, 2018 — forked from AndrasKovacs/IxFix.hs
Example for recursion schemes for mutually recursive data
View IxFix.hs
{-# LANGUAGE
UndecidableInstances, RankNTypes, TypeOperators, TypeFamilies,
StandaloneDeriving, DataKinds, PolyKinds, DeriveFunctor, DeriveFoldable,
DeriveTraversable, LambdaCase, PatternSynonyms, TemplateHaskell #-}
import Control.Monad
import Control.Applicative
import Data.Singletons.TH
@cstrahan
cstrahan / setupYubikey.sh
Created Aug 29, 2018 — forked from rpardini/setupYubikey.sh
Automated-ish setup of Yubikey for SSH logins (replace ssh-agent with gpg-agent from brew)
View setupYubikey.sh
#! /bin/bash
set -e
GPGCONF_PATH=$(which gpgconf)
if [[ "$GPGCONF_PATH" != "/usr/local/bin/gpgconf" ]]; then
echo "You don't have gnupg installed from brew, lets install it."
brew install gnupg pinentry-mac ykpers
else
@cstrahan
cstrahan / config-ayufan
Created Feb 19, 2018
Kconfig differences between nix and ayufan (for Rock64 kernel)
View config-ayufan
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 4.4.103-rockchip-ayufan-1 Kernel Configuration
#
CONFIG_ARM64=y
CONFIG_64BIT=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_MMU=y
CONFIG_ARCH_MMAP_RND_BITS_MIN=18
CONFIG_ARCH_MMAP_RND_BITS_MAX=24
@cstrahan
cstrahan / SMBDIS.ASM
Created Oct 16, 2017 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
View SMBDIS.ASM
;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 Oct 5, 2017 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
View example.go
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 Oct 5, 2017 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
View example.go
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
View 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 Aug 3, 2017 — forked from gdamjan/bridged.conf
bridged openvpn with networkd
View bridged.conf
# /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 Jul 20, 2017 — forked from paf31/Deriv.idr
Calculus of types in idris
View Deriv.idr
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
--
You can’t perform that action at this time.