Skip to content

Instantly share code, notes, and snippets.

View osa1's full-sized avatar

Ömer Sinan Ağacan osa1

View GitHub Profile
@osa1
osa1 / gist:8015396
Last active December 31, 2015 16:39
CMakeLists change to make dolphin-emu working under Linux systems with system-wide SDL installed
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4dcf97..8878284 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -557,27 +557,10 @@ if(OPENAL_FOUND)
endif()
if(NOT ANDROID)
- if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- include(FindSDL2 OPTIONAL)
@osa1
osa1 / gist:7930901
Last active December 31, 2015 03:59
graph reduction(G-machine) example
ghci> putStr $ runProg "main = S K K 3"
1) Stk [ 1: NSupercomb main [ ] ]
Heap [ 1: NSupercomb main [ ]
2: NSupercomb I [ x ]
3: NSupercomb K [ x y ]
4: NSupercomb K1 [ x y ]
5: NSupercomb S [ f g x ]
6: NSupercomb compose [ f g x ]
7: NSupercomb twice [ f ] ]
@osa1
osa1 / gist:7621898
Last active December 29, 2015 05:29
epic chat log from Love2D irc channel at oftc
[20:25] --> minerva ([email protected]) has joined this channel.
[20:25] <minerva> hello all
[20:25] <YHWH> yo
[20:25] <minerva> i need some advice from some guys
[20:26] <YHWH> most of us are guys
[20:26] <YHWH> if not lal of us
[20:26] <YHWH> all, too
[20:26] <minerva> wow
[20:26] <minerva> ok den
[20:26] <minerva> i had a sort of date last night
@osa1
osa1 / gist:7089333
Created October 21, 2013 19:17
memoized parsers in CPS
function fail(reason)
return { status = "failure", reason = reason }
end
function success(ret, idx)
return { status = "success", token = ret, new_idx = idx }
end
function token(tok)
return function (stream, idx, cont)
{-# LANGUAGE LambdaCase, GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -Wall #-}
import Data.Array.IArray
import Debug.Trace
stream :: Array Int String
stream = listArray (0, length lst - 1) lst
where
lst = [ "(", "!", "string", "?", "string", ")", "?", "string" ]
@osa1
osa1 / gist:7032758
Created October 17, 2013 21:44
shunting yard
{-# OPTIONS_GHC -Wall #-}
module ShuntingYard where
import qualified Data.Map as M
data Op = Op String Prec Assoc
| OLParen | ORParen deriving (Show)
type Prec = Int
@osa1
osa1 / gist:6498197
Last active December 22, 2015 16:18
lua return val
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> print((function () end)())
> a = (function () end)()
> print(a)
nil
@osa1
osa1 / gist:6469034
Created September 6, 2013 19:52
once working K program
module CONCAT-SYNTAX
syntax Concat ::= List{Concat1, " "}
syntax Concat1 ::= Id
| "|" Concat1 "|" // quotation
| "[" Concat "]"
| Int
| "print"
| "pop"
@osa1
osa1 / gist:6261221
Last active December 21, 2015 05:59
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Main where
@osa1
osa1 / gist:6201852
Last active December 20, 2015 21:59
➜ ghc git:(ticket3452) ✗ ../inplace/bin/ghc-stage2 --interactive
GHCi, version 7.7.20130806: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
ghci> :set +t
ghci> 1
1
it :: Num a => a
ghci> id