This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section .text | |
global _start | |
_start: | |
mov eax,1 | |
int 80h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Section "Monitor" | |
Identifier "HDMI" | |
EndSection | |
Section "Monitor" | |
Identifier "DVI" | |
Option "RightOf" "HDMI" | |
EndSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() != '': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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. |