Skip to content

Instantly share code, notes, and snippets.

View juliusmh's full-sized avatar

Julius Hinze juliusmh

View GitHub Profile
@juliusmh
juliusmh / srv200.go
Created April 19, 2022 14:41
Serve HTTP 200 to any incoming request and print path, method and request body.
package main
import (
"flag"
"fmt"
"io/ioutil"
"net/http"
"strconv"
)
@juliusmh
juliusmh / solve_right.sage
Created April 27, 2020 04:25
example SageMath script solving underdetermined matrix
def solve_right(A, b):
try: a = A.solve_right(b)
except: return "no solution"
if A.rank() == len(b): return a
return (a, matrix(A.right_kernel().basis()))
# Solve matrix A with rank 2
F = IntegerModRing(5)
A = matrix(F, [[0,2,1,3],[4,0,1,0],[2,4,0,1]])
b = vector([4,2,4])
@juliusmh
juliusmh / gridx.css
Created December 4, 2018 11:43
Dark Github GridX Theme
/*! Github Dark v1.20.84 (2018-11-19) */
/*! Repository: https://github.com/StylishThemes/GitHub-Dark */
/*! Userstyle: http://userstyles.org/styles/37035 */
/*! License: https://creativecommons.org/licenses/by-sa/4.0/ */
/* Override default browser styles */
button {
color: #b5b5b5 !important;
}
/* begin auto-generated rules - use tools/generate.js to generate them */
/* auto-generated rule for "background: #fff" */
@juliusmh
juliusmh / givensqr.sage
Created November 15, 2017 19:39
QR Decomposition in SAGE MATH (Givens rotation)
K = RR
# Input matrix here
A = matrix(K, [[-3, 32/5, 4 ],
[4, 24/5, 3 ],
[5, 6*sqrt(2), 5*sqrt(2)]])
m,n = (3,3)
@juliusmh
juliusmh / tetris.py
Created September 1, 2017 02:00
Tetris implemented in python
#!/usr/bin/env python2
import Tkinter
import random
import sys
# Represents one block in tetris
class TetrisBlock():
SHAPES = [[(0,0), (1,0), (0,1), (1,1)], # BOX
@juliusmh
juliusmh / dining_philosophers.c
Created June 26, 2017 19:00
Solution to the "Dining Philosophers" Problem in C using UNIX semaphores.
/*
Same includes as in u6_1.c. Copy Pasted some code of the given source code.
*/
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
@juliusmh
juliusmh / dock.sh
Last active February 21, 2017 04:01
modify the dock on Mac to be much more productive (autohide, no delay, short animation)
osascript -e 'tell application "System Events" to set the autohide of the dock preferences to true'; # Autohiding dock
defaults write com.apple.dock autohide-delay -float 0; # Autohiding delay 0ms
defaults write com.apple.dock autohide-time-modifier -float 0.2; # Animation time 200ms
killall Dock; # Restart dock application
@juliusmh
juliusmh / chat.py
Created June 9, 2016 15:52
Hacking-Lab.com python chat client
# !/usr/bin/env python
# Please dont judge me the code is shity i just was anooyed by the website
# Please some body clean up the mess below and implement a nicer one. Thanks!
# This code needs Ghost.py installed. (Run install.sh)
import thread
import ghost
import sys
alert("X S S");
import requests, math, os
from bs4 import BeautifulSoup
SAMPLESPERPAGE = 15
SAMPLEDIRECTORY = "samples"
class Fetcher:
def __init__(self):
self.s = requests.session()