Skip to content

Instantly share code, notes, and snippets.

Avatar
🤪

Roman Müntener FMNSSun

🤪
View GitHub Profile
View pto.py
import bson
import datetime
import sys
import queue
import threading
import time
path = lambda x: x['path']
target = lambda x: x['target']
@FMNSSun
FMNSSun / arr2nljson.py
Last active Apr 12, 2016
Convert json array to newline separated
View arr2nljson.py
#
#- arr2nljson
# munt, 2016
#
# Reads in a JSON array and outputs new-line
# separated documents
#
#
import sys
@FMNSSun
FMNSSun / dfgen.hs
Created Nov 5, 2015
Program to generate Deadfish constants
View dfgen.hs
import Data.List
import System.Environment
sqrti :: Int -> Int
sqrti = floor . sqrt . fromIntegral
squ :: Int -> Int
squ x = x * x
@FMNSSun
FMNSSun / postfix.hs
Created Nov 4, 2015
Interpreter for simple postfix expressions
View postfix.hs
import Data.List
import Data.Char
import System.Environment
isOp :: String -> Bool
isOp x = x `isInfixOf` "+-*/"
isInt :: String -> Bool
isInt ('-':x:xs) = isInt (x:xs)
@FMNSSun
FMNSSun / beam.py
Last active Nov 4, 2015
Beam interpreter in Pyhton
View beam.py
#!/usr/bin/python
import sys
if(len(sys.argv) < 5):
print 'Usage: ./beam.py path <debug> <debugpoints> <memsize>'
print ' debug: on or off'
print ' debugpoints: ;-seperated list of coordinates (e.g. 0,9;0,2)'
print ' (use -1,-1 for none)'
@FMNSSun
FMNSSun / eso.hs
Last active Oct 18, 2015
Simple esolang. Full source code for http://mroman.ch/impleso.html
View eso.hs
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Combinator
import Text.ParserCombinators.Parsec.Expr
import Text.ParserCombinators.Parsec.Token
import Data.Maybe
data Expression =
Loop [Expression]
| Literal Integer