Skip to content

Instantly share code, notes, and snippets.

View RodrigoDornelles's full-sized avatar
:bowtie:
IEEE 754

RodrigoDornelles

:bowtie:
IEEE 754
View GitHub Profile
This file has been truncated, but you can view the full file.
local BOOTSTRAP = {}
local BOOTSTRAP_DISABLE = false
local BOOTSTRAP_DIRS = {'src', 'src/lib', 'src/lib/protocol', 'src/lib/util', 'src/lib/cli', 'src/lib/engine', 'src/lib/engine/raw', 'src/lib/engine/draw', 'src/lib/engine/draw/ui', 'src/lib/engine/debug', 'src/lib/engine/api', 'src/lib/object', 'src/lib/common', 'src/env', 'src/cli', 'src/cli/tools', 'src/cli/commands', 'src/engine', 'src/engine/meta', 'src/engine/meta/html5_ginga', 'src/engine/meta/html5_webos', 'src/engine/meta/html5_tizen', 'src/engine/core', 'src/engine/core/native', 'src/engine/core/html5', 'src/engine/core/love', 'src/engine/core/lite', 'src/engine/core/micro', 'src/engine/core/repl', 'assets', 'samples', 'samples/maze3d', 'samples/dvdplayer', 'samples/pong', 'samples/wellcome', 'samples/capybird', 'samples/launcher', 'samples/gridsystem', 'samples/stream', 'samples/two_games', 'samples/helloworld', 'samples/asteroids', 'mock', 'ee', 'ee/lib', 'ee/lib/protocol', 'ee/lib/util', 'ee/engine', 'ee/engine/meta', 'ee/engine/meta/ginga', 'e

How to install Podman 4 in Linux Mint

wget -O- "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/Release.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/devel_kubic_libcontainers.gpg
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list
@RodrigoDornelles
RodrigoDornelles / dont_assign_string.c
Created February 23, 2023 14:59
Dangerous memory leakage without compiler warnings in C Language.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char* foo = malloc(4);
char* old_foo = foo;
foo[0] = 'f';
foo[1] = 'o';
foo[2] = 'o';
@RodrigoDornelles
RodrigoDornelles / max.py
Created February 2, 2023 13:50
greatest number between A and B
def max(a, b):
return (a + b + abs(a - b)) / 2
@RodrigoDornelles
RodrigoDornelles / safe_secret_input_posix.c
Created December 20, 2022 20:47
How to handle terminal in a safe protected way when cash/interrupt.
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
static unsigned int fid;
static struct termios term;
static char error_stdin[] = "[!] error in /dev/stdin";
static char question_name[] = "[?] what is your secret name:\n";
static char awsner_name_1[] = "[!] ok, good day ";
static char awsner_name_2[] = "!\n";
@RodrigoDornelles
RodrigoDornelles / force_true_isatty.sh
Created September 6, 2022 13:59
mama I want to take the risk of breaking my system.
script --return --quiet -c "[command here]" /dev/null
@RodrigoDornelles
RodrigoDornelles / from-scratch-boolean.js
Created July 8, 2022 23:41
from scratch boolean logic recreation based on the pure functional paradigm and lambda calculus.
const TRUE = (p) => (q) => (p)
const FALSE = (p) => (q) => (q)
const OR = (p) => (q) => p(p)(q)
const NOT = (p) => (p)(FALSE)(TRUE)
const AND = (p) => (q) => (p)(q)(FALSE)
const PROG = (func) => FALSE(func())(PROG)
const PRINT = (text) => () => TRUE(console.log(text))
const IF = (cond) => (execute) => (nonexecute) => (cond(execute)(nonexecute))()
PROG
@RodrigoDornelles
RodrigoDornelles / from-scratch-oop.php
Last active July 21, 2022 20:54
from scratch object-oriented recreation based on the functional paradigm.
<?php
$class = call_user_func(function () {
$objects = [];
return function() use (&$objects) {
return (object) [
'instanceof' => function($object) use (&$objects) {
return in_array($object, $objects);
},
@RodrigoDornelles
RodrigoDornelles / animate-number.js
Created December 28, 2021 17:43
Increment animation when scroll to number
document.addEventListener("DOMContentLoaded", () => {
const elements = document.querySelectorAll('.animate-number');
const lerp = (start, end, amt) => Math.round((1-amt)*start+amt*end);
const interval = 10;
const amount = 0.03;
const increment = (el) => {
el.setAttribute('data-now', lerp(el.getAttribute('data-now'), el.getAttribute('data-end'), amount));
el.innerText = Number(el.getAttribute('data-now')).toLocaleString();
@RodrigoDornelles
RodrigoDornelles / command.sh
Created July 14, 2021 17:58
Discover folders that take up more disk space.
du -bsh * > big_folders.txt &