Skip to content

Instantly share code, notes, and snippets.

View hashalon's full-sized avatar
🌧️

hashalon hashalon

🌧️
  • Belgium / France
View GitHub Profile
@hashalon
hashalon / bezier.cpp
Created January 29, 2023 01:40
WIP Function to draw bezier curves on RP2040
#include "pico/stdlib.h"
#include "pico_graphics.hpp"
/*
# RASTERIZATION OF BÉZIER CURVES WITH WIDTH
Bézier curves follow a generic formula `B(t) = SUM(binomial(i, n) (1 - t)^(n - i) t^i P_i)`
In our case, we are interested in Bézier curves of order 2 and 3.
To draw the curve, we simply compute a large amount of points along the curve.
@hashalon
hashalon / ellipse.cpp
Last active January 20, 2023 00:25
function to draw ellipses on rp2040
#include "pico/stdlib.h"
#include "pico_graphics.hpp"
/*
# RASTERIZATION OF ELLIPSES
We start from the equation of a rotated ellipse:
`(x cosθ - y sinθ)² / a² + (x sinθ + y cosθ)² / b² = 1`
with
- `a` the major radius,
#!/bin/env python
import sys
import os
import os.path
import argparse
import PIL.Image
# write the selected tile to the output
def write_chr_square (data, tile_x, tile_y, output):
@hashalon
hashalon / dorime.wiz
Created February 4, 2020 23:36
WIZ code to generate a dumb ROM with a dorime dog.
//
//
//
//
// Specify that the target system is the NES
config {
format = "nes",
}
@hashalon
hashalon / Bunny.wren
Created January 15, 2019 13:51
Game for TIC-80 where the goal is to catch drops. Idea by Acekid.
// title: Bunny catch stuff
// author: Acekid, Harraps
// desc: the bunny must catch stuff
// script: wren
import "random" for Random
class World {
// GETTERS
@hashalon
hashalon / index_maker.py
Created December 20, 2018 13:36
Scripts and shaders used to generate a reduced palette post processing effect for Godot
"""
Given three textures, generate an index texture
that can be used in godot with the object shader
parameters:
1 - input indexes texture (just saturated colors)
2 - input gradient (grayscale)
3 - input unlit (grayscale)
4 - output name (without extension)
"""
@hashalon
hashalon / bunny-time.fish
Created November 19, 2018 21:47
Display time in the world using bunnies.
#!/usr/bin/fish
set -l us (env TZ="America/Los_Angeles" date +%R)
set -l eu (env TZ="Europe/Brussels" date +%R)
set -l jp (env TZ="Asia/Tokyo" date +%R)
#echo $us
#echo $eu
#echo $jp
@hashalon
hashalon / panda-sign.coffee
Created November 15, 2018 13:05
Allow to print colored pandas holding signs (similar to bunny-sign.coffee but with different ears)
#!/usr/bin/coffee
#
# Display an array of pandas holding signs
#
# args:
# -b / --bold : display the pandas as bold text
# -C / --centered : display the pandas in the center of the terminal
# -c / --colored : prepend each text by the color to use
@hashalon
hashalon / bunny-jp.coffee
Last active November 13, 2018 21:06
Allow to display an ascii bunny displaying japanese text in traditional reading order.
#!/usr/bin/coffee
#
# Display a single bunny displaying japanese text vertically
#
# args:
# -b / --bold : display the bunnies as bold text
# -C / --centered : display the bunnies in the center of the terminal
# -c / --colored : prepend each text by the color to use
@hashalon
hashalon / bunny-mpd.coffee
Created October 12, 2018 20:05
DIsplay informations about the session: user, host and song played on mpd
#!/usr/bin/coffee
# dependencies
os = require "os"
bunny = require "./bunny-sign.coffee" # my bunny-sign.coffee script
util = require "util"
exec = require("child_process").exec
# and also ncmpcpp
# display current song information