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:3489175
Created August 27, 2012 14:50
sudoku
module Sudoku where
import Prelude hiding (Nothing)
import Data.List ((\\), union)
data Val = Val Int
| Nothing
| Alt [Int]
deriving (Show, Eq)
@osa1
osa1 / Lexer.hs
Created August 29, 2012 05:03
separated lexing and parsing stages in parsec
module Lexer
( Token(..)
, TokenPos
, tokenize
) where
import Text.ParserCombinators.Parsec hiding (token, tokens)
import Control.Applicative ((<*), (*>), (<$>), (<*>))
data Token = Ide String
@osa1
osa1 / gist:3716984
Created September 13, 2012 19:33
left-recursion ;-(
var :: Parser Var
var = buildVar <$> namePart <*> funcalls <*> selectors
where namePart :: Parser (Either Name Exp)
namePart = (Right <$> between (spChar '(') (spChar ')') exp)
<|> (Left <$> name)
funcalls :: Parser [(Maybe Name, FunArg)]
funcalls = many argPart
@osa1
osa1 / gist:3795313
Created September 27, 2012 17:36
kaleidoscope 3
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE NamedFieldPuns #-}
module Main where
import LLVM.Wrapper.Core
import LLVM.Wrapper.Analysis
import qualified LLVM.FFI.Core as LL
import qualified Data.Map as M
import Control.Monad.State
;push dx
sub sp, 2
xchg bp, sp
mov [bp], dx
xchg bp, sp
;pop bx
xchg sp, bp
mov bx, [bp]
xchg sp, bp
@osa1
osa1 / JavaScript.sublime-build
Created October 25, 2012 18:21
JavaScript.sublime-build
{
"cmd": ["/home/sinan/node_modules/.bin/uglifyjs", "--overwrite", "-b", "$file"],
"selector": "source.javascript"
}
@osa1
osa1 / gist:3954620
Created October 25, 2012 18:47
qtcreator run settings
xterm -geometry 80x50 -fa "DejaVu Sans Mono-8" -e
@osa1
osa1 / gist:4012772
Created November 4, 2012 17:54
zyper lr -u
➜ ~ zypper lr -u
# | Alias | Name | Enabled | Refresh | URI
---+---------------------------+------------------------------------+---------+---------+-----------------------------------------------------------------------------------
1 | Haskell | Haskell | Yes | Yes | http://download.opensuse.org/repositories/devel:/languages:/haskell/openSUSE_12.2/
2 | Tumbleweed | Tumbleweed | Yes | Yes | http://download.opensuse.org/repositories/openSUSE:/Tumbleweed/standard/
3 | openSUSE_Current_OSS | openSUSE Current OSS | Yes | Yes | http://download.opensuse.org/distribution/openSUSE-current/repo/oss/
4 | openSUSE_Current_non-OSS | openSUSE Current non-OSS | Yes | Yes | http://download.opensuse.org/distribution/openS
@osa1
osa1 / .Xmodmap
Created November 7, 2012 15:56
.Xmodmap
!! ~/.Xmodmap
!!
!! Use this as a template for $HOME/.Xmodmap
!!
!! The leading `!' is the comment sign.
!!
!! Please note: the natural way to assign keys are their keycodes.
!! The only problem is, that keycodes do depend on the architecture,
!! therefore keysymbols are used herein. This has the disadvantage
!! that this file can only be called once with the program xmodmap.
@osa1
osa1 / gist:4148722
Created November 26, 2012 15:14
ffffffffffff
➜ ~ cabal install pandoc
Resolving dependencies...
In order, the following would be installed:
List-0.5.1 (new package)
base64-bytestring-1.0.0.0 (new package)
blaze-html-0.4.3.4 (new package)
digest-0.0.1.2 (new package)
hs-bibutils-4.15 (new package)
pandoc-types-1.9.1 (new package)
parsec-3.1.3 (reinstall) changes: mtl-2.0.1.0 -> 2.1.2