Skip to content

Instantly share code, notes, and snippets.

@Zolomon
Zolomon / main.py
Last active March 31, 2019 19:05
Teknikmuseet, ugly hack
"""
We split the maze into sevent walkable regions, denoting
the exits with 'b' for blue and 'r' for red in the following
figure.
.....................
.22222r3333333333b33.
.bb.bb.rr.....33..33.
.11r66b444444r333333.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
@Zolomon
Zolomon / picasso.cs
Created May 11, 2017 15:04
Draw shenanigans to the screen!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Picasso
{
class Program
package gdx.scala.demo
import java.util.Comparator
import com.badlogic.ashley.core.{Component, ComponentMapper, Entity, Family}
import com.badlogic.ashley.systems.SortedIteratingSystem
import gdx.scala.demo.components.PositionComponent
class RenderingSystem() extends
public class RenderingSystem extends SortedIteratingSystem {
private ComponentMapper<RenderableComponent> rm;
private ComponentMapper<PositionComponent> pm;
public RenderingSystem() {
super(Family.all(RenderableComponent.class, PositionComponent.class).get(), new ZComparator());
rm = ComponentMapper.getFor(RenderableComponent.class);
pm = ComponentMapper.getFor(PositionComponent.class);
}
@Zolomon
Zolomon / spellcheck.sh
Created April 27, 2016 14:08
Find english and swedish typos in a text file.
#!/usr/bin/bash
echo "Spellchecking $1"
tr -s '[[:punct:]][:space:]]' '\n' < $1 | sort | uniq | \
aspell pipe --encoding utf-8 --lang=sv | sort | uniq | cut -d ' ' -f 2 | sort | uniq | \
aspell pipe --encoding utf-8 --lang=en | sort | uniq | cut -d ' ' -f 2
echo "Spellchecked $1"
@Zolomon
Zolomon / tasks.cs
Created April 17, 2016 09:37
Running tasks in parallel
var spinner = new Action<int, string>((ms, name) =>
{
var start = DateTime.Now;
while (true)
{
var now = DateTime.Now;
if ((now - start).Milliseconds > ms)
{
Console.WriteLine($"[{name}]");
start = now;
@Zolomon
Zolomon / before.rules
Created March 4, 2016 18:07
Bla bla bla, remove plx
*filter
# Allow all outgoing, but drop incoming and forwarding packets by default
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# Custom per-protocol chains
:UDP - [0:0]
:TCP - [0:0]
:ICMP - [0:0]
@Zolomon
Zolomon / lab2.m
Last active February 25, 2016 10:28
laboration 2 - applied mathematics
startlab2;
whos;
% close all;
%% %%%%%%%%% 2.2
% plot the theta function (t > t_0 = 1, t < t_0 = 0)
%figure;plot(t, theta);
% plot the DeltaDirac-function (t = t_0 ==> 1, else 0)
@Zolomon
Zolomon / MailGenerator.fs
Last active February 10, 2016 10:21
Newsletter Generator
namespace MailGenerator
module Generator =
open System.IO
open System.Text.RegularExpressions
open FSharp.Data
open FSharp.Data.JsonExtensions
type Template = string * string -> string