Skip to content

Instantly share code, notes, and snippets.

View Luiz-Monad's full-sized avatar
💭
magic monads

Luiz Luiz-Monad

💭
magic monads
View GitHub Profile
@Luiz-Monad
Luiz-Monad / rbac.ps1
Created February 14, 2024 23:01
azure bicep rbac
@description('Location of service resource')
param location string
@description('Name of the service resource')
param name string
@description('Current time set by system')
param currentTime string = utcNow()
resource script 'Microsoft.Resources/deploymentScripts@2019-10-01-preview' = {
@Luiz-Monad
Luiz-Monad / android.sh
Created January 27, 2024 00:20
android_binder.ko
apt-get install --no-install-recommends -yq dpkg-dev dkms git
apt-get install --no-install-recommends -yq fakeroot build-essential libncurses-dev xz-utils libssl-dev flex libelf-dev bison bc
cp v$VER/include/uapi/linux/android/binder.h `find /usr/src/ | grep include/uapi/linux/android/binder.h`
cp v$VER/include/uapi/linux/android/binderfs.h `find /usr/src/ | grep include/uapi/linux/android/binderfs.h`
# upstream sources
VER=$(uname -r | cut -d- -f1)
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git --depth 1 --tag v$VER
@Luiz-Monad
Luiz-Monad / ngrok.sh
Last active September 17, 2023 22:16
NGrok Debug Script
#!/bin/bash -e
USER_NAME=`whoami`
mkdir -p $HOME/.ssh
chown $USER_NAME:$USER_NAME $HOME/.ssh -R
KEYS=$HOME/.ssh/authorized_keys
echo "$NGROK_SSH_PUBKEY" | tee -a $KEYS
sort $KEYS | uniq > tmp && mv tmp $KEYS
chmod 600 $KEYS
@Luiz-Monad
Luiz-Monad / fork_join.go
Created June 20, 2023 17:08
fork_join go
func DoWorkPooled[T any](items []T, poolSize int, task func(T) (*T, error)) ([]T, error) {
if poolSize == 0 { // 0 means sequential
output := []T{}
for _, item := range items {
if out, err := task(item); err != nil {
return output, err
} else {
if out != nil {
output = append(output, *out)
@Luiz-Monad
Luiz-Monad / Config.fs
Created June 15, 2023 17:01
EventHorizon is a framework for creating MVVM applications [WIP in progress] (all rights reserved for now)
namespace EventHorizon.Backend.Model
open System
open System.Data.Entity
open EventHorizon.Backend.Extension.DbContextModule
open EventHorizon.Backend.Extension.DbModelBuilderModule
module Config =
https://arxiv.org/abs/1805.04908
https://mitpress.mit.edu/9780262544030/the-cortex-and-the-critical-point/
https://www.nih.gov/news-events/news-releases/memory-gene-goes-viral
https://news.mit.edu/2021/neurons-humans-mammals-1110
https://www.biorxiv.org/content/10.1101/2021.05.29.446289v4
https://journals.aps.org/pre/abstract/10.1103/PhysRevE.105.014401
https://www.sciencedirect.com/science/article/pii/S0896627321005018
https://www.biorxiv.org/content/10.1101/613141v1
https://www.nature.com/articles/s41467-022-29384-4
https://arxiv.org/pdf/1704.05018.pdf
@Luiz-Monad
Luiz-Monad / gpt.html
Created April 13, 2023 18:22
Index the Windows Registry for fast search
<div class="flex flex-col items-center text-sm dark:bg-gray-800"><div class="group w-full text-gray-800 dark:text-gray-100 border-b border-black/10 dark:border-gray-900/50 dark:bg-gray-800"><div class="text-base gap-4 md:gap-6 md:max-w-2xl lg:max-w-xl xl:max-w-3xl p-4 md:py-6 flex lg:px-0 m-auto"><div class="w-[30px] flex flex-col relative items-end"><div class="relative flex"><span style="box-sizing: border-box; display: inline-block; overflow: hidden; width: initial; height: initial; background: none; opacity: 1; border: 0px none; margin: 0px; padding: 0px; position: relative; max-width: 100%;"><span style="box-sizing: border-box; display: block; width: initial; height: initial; background: none; opacity: 1; border: 0px none; margin: 0px; padding: 0px; max-width: 100%;"><img style="display: block; max-width: 100%; width: initial; height: initial; background: none; opacity: 1; border: 0px none; margin: 0px; padding: 0px;" alt="" aria-hidden="true" src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2
@Luiz-Monad
Luiz-Monad / base_test.ps1
Created October 25, 2022 23:59
how-to-normalize-a-path-in-powershell
# Clear-Host
Import-Module Pester
# New-Item -ItemType Directory 'a/b' -Force -ErrorAction Ignore
# New-Item -ItemType Directory 'c' -Force -ErrorAction Ignore
# New-SmbShare -Name "Shared" -Path "./shared" -FullAccess "Everyone"
$ErrorActionPreference = 'Stop'
$PesterPreference = [PesterConfiguration]::Default
$PesterPreference.Output.StackTraceVerbosity = 'None'
@Luiz-Monad
Luiz-Monad / Download_Worry_Dream_References.linq
Created August 16, 2022 21:48 — forked from secretGeek/Download_Worry_Dream_References.linq
LinqPad script that downloads all PDFs/etc from Bret Victors worry dream refs page.
void Main()
{
// LinqPad script that downloads all PDFs/etc from Bret Victors worry dream refs page.
var targetPath = @"PATH_TO_WHERE_YOU_KEEP_YOUR_EBOOK\eBooks";
//These filenames were extracted from http://worrydream.com/refs/ -- using NimbleText.
//(TODO: Use regex or html agility pack to find them programmatically)
var refs = new string[] {
"Hamming-TheArtOfDoingScienceAndEngineering.pdf",
"Licklider-IntergalacticNetwork.pdf",
@Luiz-Monad
Luiz-Monad / pair_.md
Created July 3, 2022 00:12 — forked from caotic123/pair_.md
C++ : A functional analysis of immutable pair construction

Abstraction type system

Type system is a construction for guarantees safely in a language, though exist many other aplications like metaprogramming... It's means that i can writes a program but with a safe way, sure it's is perfect why it's solve many problems that programmers has after of compilation. The main idea that i can encode and represent a subset of solutions with a safe type system and better maybe the type can help me represent that.

Data representing

Ok it's mean i have a safe type system and i could represent my types of data..... Ok sure...., but no... limited type system have a weak power of abstraction(no i am not talking about c++ but yes a little part of the language).

The problem of "pair"

Let's go represent a pair: Pair is a tuple of the two values like (P x y), where x and y are values, in this discussion the values x and y can be encode a T type and a Tuple T type.