Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# This file is Copyright (c) 2019 Antti Lukats <[email protected]>
# This file is Copyright (c) 2019 msloniewski <[email protected]>
# License: BSD
import argparse
from migen import *
@Frank-Buss
Frank-Buss / test.cpp
Last active February 24, 2020 11:17
floating point tests with NTL lib
/*
To comppile it on Debian, first install the package libntl-dev:
sudo apt-get install libntl-dev
then you can compile and run it like this:
g++ test.cpp -lntl -o test ; ./test
output on my system:
mandelbrot calculation at point (-0.025, 0.643265)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
public void test(int ID)
{
System.Type types = {
typeof(Integer),
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private static System.Type[] types = {
typeof(Integer),
typeof(Long),
typeof(String)};
@Frank-Buss
Frank-Buss / OlympicRings.hs
Created March 25, 2020 23:59
creates an olympic rings image and saves it as test.tga
-- creates an olympic rings image and saves it as test.tga
-- output: http://www.frank-buss.de/haskell/OlympicRings.png
import Data.Binary
-- image size
data Size =
Size
{ width :: Integer
, height :: Integer
@Frank-Buss
Frank-Buss / barcode.py
Created March 31, 2020 12:51
Australia Post tracking number extractor
#!/usr/bin/python3
# Converts the 56 digits 2D Australia Post barcode to the 22 digits tracking number.
# Reads from stdin until newline, and copies the tracking number to the clipboard.
# Other characters then digits are removed.
#
# Needs Python3 and the clipboard library. Install from the command line like this:
# pip3 install clipboard
# Then save this file as barcode.py and start the script like this:
# python barcode.py
@Frank-Buss
Frank-Buss / dynamic-test.cs
Created April 1, 2020 10:54
using "dynamic" in C# to call overloaded methods
using System;
using System.Collections.Generic;
abstract class Tile
{
}
class SeaTile : Tile
{
}
@Frank-Buss
Frank-Buss / png2ansi.py
Last active July 18, 2021 12:42
Converts a PNG image to an echo command with ANSI codes. Example: https://i.imgur.com/Kw6LUbG.png
#!/usr/bin/env python3
# Converts a PNG image to an echo command with ANSI codes
# Copyright (c) 2020, Frank Buss
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@Frank-Buss
Frank-Buss / clean.bat
Created April 19, 2020 13:35
Unity clean script
rd /s /q Library
rd /s /q Temp
rd /s /q obj
rd /s /q logs
rd /s /q .vs
del /s /q /f *.csproj
del /s /q /f *.pidb
del /s /q /f *.unityproj
del /s /q /f *.DS_Store
del /s /q /f *.sln
@Frank-Buss
Frank-Buss / TilemapTest.cs
Created June 27, 2020 09:02
load a tileset PNG from the streamingAssets folder, and create a Unity Tilemap and all necessary objects with a C# script
using UnityEngine;
using UnityEngine.Tilemaps;
// Load a tileset PNG from the streamingAssets folder, and create a
// Unity Tilemap and all necessary objects with a C# script.
// Attach this script to an empty GameObject.
// Copyright 2020 by Frank Buss. Can be used for free in any project.
public class TilemapTest : MonoBehaviour