Skip to content

Instantly share code, notes, and snippets.

View Mroik's full-sized avatar

Mroik/PositiveC Mroik

View GitHub Profile
@Mroik
Mroik / moving_stuff.rs
Last active April 23, 2023 16:40
2D stuff on terminal
use std::time::Instant;
struct Engine {
timer: Instant,
tick_rate: u128,
fps: u128,
last_update: u128,
last_draw: u128,
acc: u128,
width: i32,
int: type.
z: int.
s: int -> int.
0 = z.
1 = s 0.
2 = s 1.
3 = s 2.
4 = s 3.
5 = s 4.
int: type.
z: int.
s: int -> int.
0 = z.
1 = s 0.
2 = s 1.
3 = s 2.
4 = s 3.
5 = s 4.
@Mroik
Mroik / war.elf
Created March 18, 2023 00:09
Team fight program written in twelf
int: type.
z: int.
s: int -> int.
0 = z.
1 = s 0.
2 = s 1.
3 = s 2.
4 = s 3.
5 = s 4.
@Mroik
Mroik / q.elf
Last active March 30, 2023 18:29
Q with no negatives
int: type.
z: int.
s: int -> int.
0 = z.
1 = s 0.
2 = s 1.
3 = s 2.
4 = s 3.
5 = s 4.
@Mroik
Mroik / remote_print.erl
Last active December 20, 2022 03:20
A simple helper function to print on a remote shell in erlang
-module(remote_print).
-export([print/3]).
print(Node, String, Args) ->
RemotePid = rpc:call(Node, erlang, whereis, [shell]), % Assume that on Node `register(shell, self())` was ran
{group_leader, RemoteGroup} = rpc:call(Node, erlang, process_info, [RemotePid, group_leader]),
spawn(Node, io, format, [RemoteGroup, String, Args]).
@Mroik
Mroik / select_emoji.sh
Last active November 3, 2022 22:20
A script to copy an emoji into the clipboard
#!/bin/bash
tail -n +5 "$0" | dmenu -i -l 20 | cut -d\ -f1 - | sed -z "s/\n//g" | xclip -i -selection clipboard
exit
😀 Grinning Face
😃 Grinning Face with Big Eyes
😄 Grinning Face with Smiling Eyes
😁 Beaming Face with Smiling Eyes
😆 Grinning Squinting Face
😅 Grinning Face with Sweat
@Mroik
Mroik / preferred.md
Last active September 1, 2024 21:26
Preferred styling
astyle --style=kr --indent=tab -U -xg
@Mroik
Mroik / tree.elf
Last active October 9, 2022 23:36
Trees in twelf
int: type.
z: int.
s: int -> int.
<: int -> int -> type.
%infix right 1 <.
less/0: X < s X.
less/1: X < s Y
<- X < Y.
@Mroik
Mroik / sorting.elf
Last active October 9, 2022 23:30
Sorting in Twelf
int: type.
z: int.
s: int -> int.
<: int -> int -> type.
%infix right 1 <.
less/0: X < s X.
less/1: X < s Y
<- X < Y.