Skip to content

Instantly share code, notes, and snippets.

View Luiz-Monad's full-sized avatar
💭
computing

Luiz Luiz-Monad

💭
computing
View GitHub Profile
@Luiz-Monad
Luiz-Monad / gc.cpp
Created July 27, 2017 14:23
stupid small GC allocator
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <algorithm>
using namespace std;
template<typename T>
T * gcalloc(uintptr_t * buf, size_t qty, size_t max) {
if (buf == nullptr) {
@Luiz-Monad
Luiz-Monad / lectures_watching_tracklog.md
Last active January 30, 2020 16:33 — forked from mloskot/lectures_watching_tracklog.md
Watched Lectures Log (programming, mathematics, algorithms, databases, etc.)
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
template<typename T>
const T tailcall(T p, function<bool (T)> ends, function<T (const T &)> next );
@Luiz-Monad
Luiz-Monad / solidIsFp.md
Last active February 4, 2020 13:14 — forked from anabastos/solidIsFp.md
Solid is FP - Luiz Stangarlin

SOLID is FP!

So, I decided to write a little thing, only to practice writing, it's about SOLID being compared between class-based-OO and FP, and there will be grammar errors and there will be a lot of formatting errors, 'bear' with me as I type this as fast as I can. Also correct if I'm wrong. Warning, wall of text in English.

Single responsibility principle

" a class should have only a single responsibility " A pure function is something with a single responsibility, turning its input into an output. What could be simpler?.

C#

@Luiz-Monad
Luiz-Monad / Your language sucks.md
Last active September 22, 2017 00:12 — forked from P4/Your language sucks.md
Your programming language sucks

You appear to be advocating a new...

  • Functional
  • Imperative
  • Object-oriented
  • Procedural
  • Stack-based
  • "Multi-paradigm"
  • Lazy
  • Eager
@Luiz-Monad
Luiz-Monad / fft.apl
Last active January 18, 2021 00:28
FFT APL
[Math/APL] (warning: walls of text and equations)
I loved APL !
Exponential negativo em alpha (primeiro parametro) te dá numeros complexos ! ( http://www.jsoftware.com/papers/satn40.htm )
Geralmente eu odeio trabalhar com arrays em C, é muito cumbersome. Mas em APL arrays são lindos.
Mas o mais legal mesmo é a implementação das funções trigonometricas diadicas.
This language is so good for simple mathematics, now I know why such a beaultiful language didn't work in the boring 'real life'.
Ontem estava estudando a transformada de Fourier, dai falaram de APL, dai eu tive um sonho.
Hum, lets implement it !
@Luiz-Monad
Luiz-Monad / persp_transform.cs
Created September 29, 2017 00:12
Perspective Transformation
void Main()
{
}
public struct Matrix {}
private static Matrix multiply(Matrix ma, Matrix mb) {
float[] a = new float[9];
ma.getValues(a);
float[] b = new float[9];
@Luiz-Monad
Luiz-Monad / modinverse.py
Last active January 18, 2021 00:20 — forked from ofaurax/modinverse.py
RSA in python
#!/usr/bin/env python3
p = 101149
q = 201829
def gcd(a, b):
while b:
a, b = b, a%b
return a
@Luiz-Monad
Luiz-Monad / cold_crypt.ps1
Created November 7, 2017 16:26
cold storage crypto
function encrypt ([securestring] $pass) {
$key = (2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43,6,6,6,6,6,6,31,33,60,23)
$securepass = $pass | ConvertFrom-SecureString -Key $key
$bytes = [byte[]][char[]]$securepass
$csp = New-Object System.Security.Cryptography.CspParameters
$csp.KeyContainerName = 'SuperSecretProcessOnMachine'
$csp.Flags = $csp.Flags -bor [System.Security.Cryptography.CspProviderFlags]::UseMachineKeyStore
$rsa = New-Object System.Security.Cryptography.RSACryptoServiceProvider -ArgumentList 5120,$csp
# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.
cmake_minimum_required(VERSION 3.4.1)
set(root_DIR ${CMAKE_SOURCE_DIR})
include_directories(
${root_DIR}/include
${root_DIR}/include/ogg
${root_DIR}/include/stream
${root_DIR}/include/vorbis