Skip to content

Instantly share code, notes, and snippets.

View pta2002's full-sized avatar
💻
Aaaaaaaaaaa

Pedro Alves pta2002

💻
Aaaaaaaaaaa
View GitHub Profile
@pta2002
pta2002 / -
Created September 10, 2017 14:27
Linking hello ...
/usr/bin/ld: cannot find -lHSbase-4.9.1.0
/usr/bin/ld: cannot find -lHSinteger-gmp-1.0.0.1
/usr/bin/ld: cannot find -lHSghc-prim-0.5.0.0
/usr/bin/ld: cannot find -lHSrts
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
section .text
global _start
_start:
mov eax,1
int 80h
Section "Monitor"
Identifier "HDMI"
EndSection
Section "Monitor"
Identifier "DVI"
Option "RightOf" "HDMI"
EndSection
def parse(s):
n = []
for l in s.split('\n'):
if l != '':
n.append(int(l))
return n
with open('d5in.txt') as f:
nums = parse(f.read())
pos = 0
bank = [5,1,10,0,1,7,13,14,3,12,8,10,7,12,0,6]
seenCombos = []
seen = False
cycles = 0
while not seen:
seenCombos.append(bank.copy())
maxindex = bank.index(max(bank))
b = bank[maxindex]
class Node(object):
def __init__(self, name, weight, children):
self.name = name
self.weight = weight
self.children = children
def parse(content):
queue = {}
for l in content.split('\n'):
if l.strip() != '':
import time
class Node(object):
def __init__(self, name, weight, children):
self.name = name
self.weight = weight
self.children = children
def __str__(self):
return self.name + " " + str(self.children)
import Data.Vector as V
-- parsing
parse :: String -> V.Vector Int
parse = fromList . fmap read . lines
run :: V.Vector Int -> Int
run v = go v 0
where go v n
| n < 0 || n >= V.length v = 0
import Text.Parsec
import Text.Parsec.String
data Direction = U | D deriving Show
data Layer = Layer Int Int Int Direction deriving Show
-- parse
input = [ Layer 0 3 0 U, Layer 1 2 0 U, Layer 4 4 0 U, Layer 6 4 0 U ]
p_layer :: Parser Layer
--- A simple module for dealing with strings and unicode.
-- @module string
-- @type String
local String = {}
String.__index = String
local utf8 = require "utf8"
--- Creates a String object.
-- @tparam string text The text to encapsulate.
-- @return The String object.