Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
unsigned long long int c(unsigned long long int ,unsigned long long int);
unsigned long long int e(unsigned long long int);
unsigned long long int f(unsigned long long int);
#define X 10
#define Y 20
unsigned long long int pULLU(unsigned long long int x){
#include <stdio.h>
char lower(char c){
return c | 0b0100000;
}
char upper(char c){
return c & 0xdf;
}
int ggt(int m, int n)
{
if(!m)
return n;
return ggt(n%m , m);
}
int phi(int n)
{
int cnt = 0;
def polynomial(degree):
def poly(x):
return np.asarray([x**g for g in range(degree)]).reshape((degree, x.shape[0])).transpose()
return poly
package main
import (
"fmt"
"encoding/json"
)
func main() {
dict := make(map[int]string)
dict[12] = "Lukas"
@steinelu
steinelu / getTerminalSize.go
Last active November 22, 2024 14:46
Get Terminal size in golang
func consoleSize() (int, int) {
cmd := exec.Command("stty", "size")
cmd.Stdin = os.Stdin
out, err := cmd.Output()
if err != nil {
log.Fatal(err)
}
s := string(out)
@steinelu
steinelu / Powershell matchgroups (regex)
Created October 10, 2020 21:32
How to use matchgroups in powershell
"Hallo Welt!" | Select-String ".* (.*)" | ForEach-Object {$_.Matches.Groups[1]}
@steinelu
steinelu / template.tex
Created November 8, 2020 22:24
assignment template
\documentclass[12pt,a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{listings}
\usepackage{amsmath,amssymb,amstext,amsthm}
\usepackage{tikz}
\usepackage{hyperref}
\usepackage{url}
\usepackage[headsepline]{scrpage2}
function foo(n::UInt)
if n == 1 || n == 0
return n
end
if n%2 == 0
return 4 * foo(UInt(n/2))
else
return 4 * foo(UInt(floor(n/2))) + 1
end
end
@steinelu
steinelu / shutdown.ps1
Last active October 1, 2022 16:46
a small server waiting for a single connection
# strongly inspired from https://hkeylocalmachine.com/?p=518
$listener = New-Object System.Net.HttpListener
$listener.Prefixes.Add('http://+:8000/')
$listener.Start()
while ($true){
$context = $listener.GetContext()