Skip to content

Instantly share code, notes, and snippets.

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

DornellesTV RodrigoDornelles

:bowtie:
IEEE 754
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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';

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