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
#! /usr/bin/python | |
import struct | |
#### | |
#### Matrix Math | |
#### | |
# N-Dimensional vector with operators == and * (dot product) | |
class Vector: |
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
local success, message = pcall(error, "this is an error") | |
if not success then | |
print("Caught error:", message) | |
end | |
local success, message = xpcall( | |
error, | |
function(err) | |
return debug.traceback(err, 3) | |
end, |
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
local function hook(event) | |
assert(event == "count") | |
local info = debug.getinfo(2, "Sl") -- get source file related info (S) and current line (l) | |
error("Code took to long (over 1000 instructions), aborted at file \"" .. info.short_src .. "\" line " .. info.currentline) | |
end | |
debug.sethook(hook, "", 1000) -- "" = when to call this hook, if any of "every line", "every function call" or "every function return", 1000 = call every 1000 instructions | |
local i = 0 | |
while true do | |
print(i) |
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
# --------------------------------------------- # | |
# Fachhochschule Wedel, Wintersemester 2012 # | |
# C-Uebung 04 - ALU # | |
# Hanno Sternberg # | |
# # | |
# Makefile # | |
# --------------------------------------------- # | |
# Compiler | |
CC = gcc |
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
-##- -##- -##- -##- -##- -##- -##- -##- -##- | |
-##- -##- -##- -##--##- -##--##- | |
-##- -##- -##- -##- | |
-##- -##--##- -##- -##- -##- -##- | |
-##- -##- -##--##- -##--##- -##- -##- | |
-##- -##- -##- -##- -##- -##- | |
-##- -##--##--##- -##- -##- | |
-##- -##--##--##- -##- -##--##- -##- | |
-##- -##- -##- -##- -##- -##- | |
-##- -##- -##- |
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
#pragma once | |
#include <cstddef> | |
#include <cctype> | |
#include <algorithm> | |
#include <istream> | |
#include <streambuf> | |
#include <utility> | |
#include "gsl.h" |
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
#pragma once | |
#include <array> | |
#include <utility> | |
#include <cassert> | |
#include <cstddef> | |
#include <algorithm> | |
#include "qcommon/q_platform.h" |
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
/* | |
main = interact(decode tail(lines) ctree . head . lines) | |
-- the parens here are misleading, this is really just: | |
main = interact(decode tail lines ctree . head . lines) | |
-- which comes down to this due to operator precedence: | |
main = interact((decode tail lines ctree) . head . lines) | |
*/ | |
int main() | |
{ |
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
module Main( main ) where | |
data PolishElement = PolishPlus | PolishNumber Integer deriving (Show) | |
polish :: [PolishElement] -> (Integer, [PolishElement]) | |
polish (PolishNumber x : tail) = (x, tail) | |
polish (PolishPlus : tail) = (x + y, tail'') | |
where | |
(x, tail') = polish tail | |
(y, tail'') = polish tail' |
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
module Main where | |
main :: IO () | |
main = interact $ \ input -> | |
let (serializedTree:encodedMessages) = lines input | |
tree = deserialize serializedTree | |
messages = map (decode tree) encodedMessages in | |
unlines messages | |
data PrefixTree = Leaf Char | Node PrefixTree PrefixTree |