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/python3 | |
import functools | |
# 1+0x+x^2+0x^3+0x^4+x^5 | |
p = [1, 0, 1, 0, 0, 1] | |
def format_polynom(xs): | |
return " + ".join(reversed([("x^{}".format(i) if i > 0 else "1") for i, x in enumerate(xs) if x == 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
// clang++ -std=c++17 baby_giant_step.cpp -o baby_giant_step -march=native -O3 | |
// ./baby_giant_step | |
#include <cmath> | |
#include <cstdint> | |
#include <cstdlib> | |
#include <unordered_map> | |
#include <utility> // std::swap | |
struct result { |
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 eea(r0, r1): | |
if r0 <= r1: | |
r0, r1 = r1, r0 | |
r = [r0, r1, 0] | |
s = [1, 0, 0] | |
t = [0, 1, 0] | |
i = 2 |
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
#ifndef ALTERNATIVELINKEDLIST_H | |
#define ALTERNATIVELINKEDLIST_H | |
#include "Item.h" | |
#include "List.h" | |
/* | |
* Deklariert hier die AlternativeLinkedList ohne Dummy-Element. | |
* | |
* Diese Liste soll keine FreeList verwenden, denn die move-Methoden |
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/env python | |
# -*- vim: set sts=4 sw=4 fdm=marker: -*- | |
# Please put in your name and id number here | |
# Name: | |
# Matrikelnummer: | |
from collections import defaultdict | |
from functools import reduce |
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/runhaskell | |
import Control.Monad | |
import Data.List | |
mapSucc :: (a -> a -> b) -> [a] -> [b] | |
mapSucc _ [] = [] | |
mapSucc f [x] = error "can't call mapSucc with a list of only one element" | |
mapSucc f [x, y] = [f x y] | |
mapSucc f (x:y:xs) = f x y : mapSucc f (y:xs) |
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
#[async(boxed, send)] | |
fn program_main(state: State) -> Result<(), Never> { | |
// Hack to make sure sessions is only created on the polling thread. | |
await!(futures::future::ok::<(), Never>(()))?; | |
let mut sessions: Vec<Session> = vec![]; | |
#[async] | |
for cmd in state.command_rx { | |
use UICommand::*; |
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
fn parity(xs: &[u8]) -> u64 { | |
let mut ret = 0u64; | |
for (i, _) in xs.iter().enumerate() { | |
let mut acc = 0; | |
for j in i..i + 8 { | |
let x = xs[j % xs.len()]; | |
acc ^= (x >> (7 - ((i + 1) % 8))) & 0b1; | |
} | |
ret |= (acc as u64) << (xs.len() - (i+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
# [y][x] | |
rot_table = [ | |
[0, 1, 62, 28, 27], | |
[36, 44, 6, 55, 20], | |
[3, 10, 43, 25, 39], | |
[41, 45, 15, 21, 8], | |
[18, 2, 61, 56, 14], | |
] |
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/bash | |
# Start: | |
# sudo ./vm.sh | |
# Connect: | |
# sudo spicy --uri="spice+unix:///tmp/vm_spice.socket" | |
NET_OPTIONS="-net none" && [[ $1 == "--enable-net" ]] && NET_OPTIONS="-netdev user,id=default,net=10.0.2.0/24,dhcpstart=10.0.2.9 -device virtio-net-pci,netdev=default,mac=00:16:3e:00:01:01 -net nic -net user,smb=/vm/" | |
qemu-system-x86_64 \ |