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 / cecil.fs
Created January 6, 2021 18:46
IL emit with cecil
// mono.cecil
//let definition = AssemblyNameDefinition ( assemblyName, new Version(1, 0) )
//let assembly = AssemblyDefinition.CreateAssembly ( definition , moduleName, ModuleKind.Dll )
//let mainModule = assembly.MainModule
let definition = AssemblyName ()
definition.Name <- assemblyName
definition.Version <- new Version(1, 0)
let assembly = AssemblyBuilder.DefineDynamicAssembly( definition, AssemblyBuilderAccess.Run)
let mainModule = assembly.DefineDynamicModule ( moduleName )
//let importedBaseType = mainModule.Import(actualBaseType)
@Luiz-Monad
Luiz-Monad / timemachine.fs
Created January 12, 2021 05:29
timemachine.fs
type AsyncResultBuilder ( timeMachine ) =
let mutable map = emptyMap ()
let mkOperation generator =
let intercept = generator ()
let cmds = side_effect_connection_ctx ()
let cmdList = sql_to_send cmds
@Luiz-Monad
Luiz-Monad / qdft.md
Last active January 17, 2021 17:32
Quantum DFT
@Luiz-Monad
Luiz-Monad / webpack.config.js
Created February 23, 2021 06:22
webpack from hell
// Template for webpack.config.js in Fable projects
// Find latest version in https://github.com/fable-compiler/webpack-config-template
// In most cases, you'll only need to edit the CONFIG object (after dependencies)
// See below if you need better fine-tuning of Webpack options
// Dependencies. Also required: core-js, fable-loader, fable-compiler, @babel/core, @babel/preset-env, babel-loader
const webpack = require('webpack');
//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const HtmlWebpackPlugin = require('html-webpack-plugin');
@Luiz-Monad
Luiz-Monad / sort-json.ps1
Last active February 26, 2021 20:12
sort json object by keys
function Sort-Json($json) {
$t = `
Get-Content $json -Encoding UTF8 | `
ConvertFrom-Json;
$tmp = New-Object -Type psobject;
$t.psobject.properties | `
Select-Object -Expand name | `
Sort-Object | `
ForEach-Object { $tmp | `
Add-Member -Type noteproperty -Name $_ -Value $t.$_
@Luiz-Monad
Luiz-Monad / f_sharp_gist.txt
Created February 26, 2021 21:11
F# Learning Resources
F#
--
https://fable.io/
https://fsharpforfunandprofit.com/
https://fsharpforfunandprofit.com/fppatterns/
https://safe-stack.github.io/
https://www.compositional-it.com/consultancy/safe-stack/
http://okmij.org/ftp/ML/index.html
https://nostarch.com/fsharp
@Luiz-Monad
Luiz-Monad / AndroidNdkR22.props
Created March 1, 2021 19:37 — forked from jwtowner/AndroidNdkR22.props
Build with Android NDK r22 in MSVS 2019
<PropertyGroup Label="Globals">
<Keyword>Android</Keyword>
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<ApplicationType>Android</ApplicationType>
<ApplicationTypeRevision>3.0</ApplicationTypeRevision>
<PlatformToolset>Clang_5_0</PlatformToolset>
<AndroidAPILevel Condition="'$(Platform)'=='ARM64'">android-21</AndroidAPILevel>
<AndroidAPILevel Condition="'$(Platform)'!='ARM64'">android-19</AndroidAPILevel>
<UseOfStl>c++_static</UseOfStl>
<ShowAndroidPathsVerbosity>Low</ShowAndroidPathsVerbosity>
@Luiz-Monad
Luiz-Monad / android_image_khr_2.cpp
Last active May 15, 2021 14:08
android hack to get buffers from gralloc
@@ -1,175 +0,0 @@
#include "GraphicBuffer.h"
#include <string>
#include <cstdlib>
#include <iostream>
#include <iostream>
#include <dlfcn.h>
const int GRAPHICBUFFER_SIZE = 1024;
@Luiz-Monad
Luiz-Monad / math.group.derivative.kotlin.kt
Created May 20, 2021 05:32
derivative/groups in kotlin
//diferentiable mathematical group/ring
//http://breandan.net/public/masters_thesis.pdf#page=58
interface Group<X : Group<X>>
object Top : Fun<Top>()
open class Const<T : Fun<T>>(val number : Double) : Fun<T>() { override fun toString() = "$number" }
class Sum<T : Fun<T>>(val left : Fun<T>, val right : Fun<T>) : Fun<T>() { override fun toString() = "($left + $right)" }
class Prod<T : Fun<T>>(val left : Fun<T>, val right : Fun<T>) : Fun<T>() { override fun toString() = "($left * $right)" }
class Var<T : Fun<T>>(val name: String) : Fun<T>() { override val vars: Set<Var<T>> = setOf(this) ; override fun toString() = "$name" }
@Luiz-Monad
Luiz-Monad / recurse.ts
Created November 5, 2021 23:14
Recursive type lift in typescript
type FLeaf<T, N> = { leaf: T; name: N }
type FNode<T, N> = { node: T; name: N }
type Fold<T> = {
[K in keyof T & string]:
Lift<T[K], K>
}[keyof T & string];
type Lift<T, K> =