Skip to content

Instantly share code, notes, and snippets.

@nitzel
nitzel / pnt.ts
Last active April 29, 2023 17:57
Playtak Native Tournament data structure brainstorming
/**
* Not part of MVP
*/
type TournamentType = { // not part of mvp, describes the rules of the tournament
komi: "no",
stages: [
{
type: "round robin",
maxGroupSize: 5,
rules: GameRules
@nitzel
nitzel / Docker_Cheat_Sheet.md
Created October 29, 2020 12:58
Useful commands for docker

Thanks to the tutorial Docker for Beginners from KodeKloud.

General

  • Contains only live as long as their entry point is running
    • Running e.g. docker run ubuntu will exit as soon as ubuntu has finished starting
      • docker run ubuntu sleep 5 executes sleep 5 and then exits
  • Find docker's files
    • Unix: /var/lib/docker
    • Windows
      • Run docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -i sh
@nitzel
nitzel / print-cue-file-content.py
Last active June 5, 2019 14:26
Generates the content of a .cue file to distinguish several tracks in one audiofile. I used this for foobar2000 when having a single audio file that actually contained multiple songs.
#!/usr/bin/env python3
"""
Prints out the content of a cue-file.
You can specify the performer, album, release-year, filename, fileformat
and of course the tracks with their lengths(!) and names.
Echo into a file or copy the output to a cue-file, e.g. python3 print-cue-file-content.py > trackinfo.cue
You can then open the .cue file with VLC, foobar etc.
Author: nitzel
@nitzel
nitzel / weirdcpp.cpp
Last active May 24, 2016 13:04
Zum Thema int ** nach const int ** cast
// Zum Thema int ** nach const int ** cast
// compile&run: g++ weirdcpp.cpp -std=c++11 -O0 && ./a.out
#include<iostream>
using namespace std;
int main()
{
const int v = 5;
int * p;
const int ** pp = (const int**)&p;
@nitzel
nitzel / StarCitizen_FollowOrg.js
Last active August 28, 2019 22:15
Follow/Unfollow all members of a Star Citizen organization.
/**
* @author nitzel
* @desc A simple script to follow/unfollow all members of a organization
* in Star Citizen. To use it just
* 1. log in on https://robertsspaceindustries.com
* 2. Find out the SID(Spectrum ID/handle) of your organization
* 2. Open the javascript console (Chrome: F12, ESC toggles it)
* 3. Paste this whole script and press <ENTER>
* 4. To follow all: changeOrgFollow('SID', true)
* To unfollow all: changeOrgFollow('SID', false)
@nitzel
nitzel / reflectExample.java
Last active August 29, 2015 14:24
Physically more or less correct reflection of a ball on a round object
// physically more or less correct reflection of a ball on a round object (paddle)
// to simulate speed-loss at collision, multiply ballSpeed with a factor like 0.8f (line 21)
// if you wanted the paddle to bounce away, too, it would be in the reversed direction of refAngle
// but considering that both objects are moving now, you should also consider both
// objects' mass and current speed/dir of the paddle
// check for collisions
float minDist = mBall.getWidth()/2 + mPaddle.getWidth()/2; // radius ball + paddle
float dX = mBallX - mPaddleX; // horizontal difference between ball and paddle
@nitzel
nitzel / image.php
Created May 5, 2015 17:40
for a school project, makes a remote server take a shot with a webcam, copies it to the local server and transfers it to the client
<?php
// Overwrites the local copy of an image after at least TIME_DELTA seconds
// Images are first captures by camera (HEAD request to other website)
// and then copied here from the other server.
// Next they are transfered to the user as an image, so you can treat this PHP-File as an image.
//
// By Jan Schnitker, 2015, published under the UNLICENSE, read about it here: http://unlicense.org/
// send the right headers
header("Content-Type: image/jpg"); // transmit as jpg