Skip to content

Instantly share code, notes, and snippets.

@PeterHajdu
PeterHajdu / name_of
Last active January 12, 2016 13:20
name_of
#!/usr/bin/python
first=[
"admiring",
"adoring",
"agitated",
"amazing",
"angry",
"awesome",
"backstabbing",
@PeterHajdu
PeterHajdu / Makefile
Last active January 22, 2016 08:20
c_bare
SRC = *.c
HDR = *.h
default: test
valgrind ./test
test: $(SRC) $(HDR)
gcc $(SRC) -o test -lcheck
clean:
@PeterHajdu
PeterHajdu / readme.md
Created February 9, 2016 19:54
Verifying that +peterhajdu is my blockchain ID. https://onename.com/peterhajdu
@PeterHajdu
PeterHajdu / cis194_02.hs
Last active January 29, 2017 15:26
cis194_week2
{-# LANGUAGE OverloadedStrings #-}
import CodeWorld
import Data.Foldable
character, wall, ground, storage, box :: Picture
wall = colored (grey 0.4) (solidRectangle 1 1)
ground = colored yellow (solidRectangle 1 1)
storage = solidCircle 0.3 & ground
box = colored brown (solidRectangle 1 1)
character = colored green $ solidCircle 0.2 & translated 0.2 0 (solidCircle 0.1)
@PeterHajdu
PeterHajdu / hsp.hs
Last active January 23, 2017 16:40
test basics in haskell
module Main where
import Test.Hspec
import Test.QuickCheck
sqr :: Integer -> Integer
sqr n = n * n
squareNumberIsGreaterOrEqualToZero :: Integer -> Bool
squareNumberIsGreaterOrEqualToZero n = sqr n >= 0
@PeterHajdu
PeterHajdu / shape.erl
Last active February 23, 2017 16:11
erlang homework 1
-module(shape).
-export([area/1, perimeter/1, bits/1]).
area({rectangle,{_, _}, W, H}) when (0<W) and (0<H) -> W*H;
area({circle,{_, _}, R}) when (R>0) -> R*R*math:pi();
area({triangle,A, B, C}) when (A>0) and (B>0) and (C>0) -> heron(A, B, C).
heron(A,B,C) ->
S = (A + B + C)/2,
math:sqrt(S*(S-A)*(S-B)*(S-C)).
import Control.Monad (replicateM)
import System.Random
import Test.QuickCheck
-- Exercise 1
fib :: Integer -> Integer
fib 0 = 1
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
[pg/etext92/carol10.txt]
A CHRISTMAS CAROL
by Charles Dickens
I have endeavoured in this Ghostly little book,
to raise the Ghost of an Idea, which shall not put my
readers out of humour with themselves, with each other,
with the season, or with me. May it haunt their houses
*.ibc
*.idr~
*agdai
MAlonzo