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 / genres.cs
Last active August 24, 2019 14:53
inject resources into assembly
using System;
using System.Linq;
using System.Resources;
public class MakeResource
{
public static void Run(string file, string[] resources)
{
var strt = resources;
// Define a resource file.
@Luiz-Monad
Luiz-Monad / subPath.fsx
Created August 26, 2019 19:15 — forked from nojaf/subPath.fsx
Suave subPath
open System
open Suave
open Suave.Filters
let subPath path (ctx:HttpContext) =
async {
let localPath = ctx.request.url.LocalPath
let result =
match (localPath.StartsWith(path)) with
| false -> None
@Luiz-Monad
Luiz-Monad / user.fs
Created September 13, 2019 19:00
Delayed computation example
msg {
let! xn = ApiSubmit ( API.GetWorker )
match xn with
//match! User.Get with
| Ok data ->
yield StorageSave ( DataKey.User, data )
| Error (e: FableUtil.FetchUtil.Response) ->
yield ApplicationError <| string e.Status + " " + e.StatusText
@Luiz-Monad
Luiz-Monad / cpp_fp_thread.cpp
Created September 22, 2019 02:15
thread sleep C++
#include <chrono>
#include <thread>
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <algorithm>
#include <functional>
#include <random>
#include <chrono>
ostringstream param;
param << "\x4c\x1b\x47\x4c\x31\x2c\x30\x2c";
param << string(3 - swidth.size(), '0') << swidth;
param << ",";
param << string(3 - sheight.size(), '0') << sheight;
param << ";";
string cmd = param.str();
write(f, cmd.c_str(), cmd.size());
@Luiz-Monad
Luiz-Monad / azure_segment.fs
Created October 18, 2019 00:01
azure paging
let! table = container eset
let nextSegment callcc args ct = asyncSeq {
let execute (_, filter, records) =
let query = TableQuery ()
query.TakeCount <- Option.toNullable records
let q = query.Where(filter)
table.ExecuteQuerySegmentedAsync ( q, fromContinue ct )
match! catch execute args with
| Ok segmt ->
yield! segmt.Results |> Seq.map Ok |> AsyncSeq.ofSeq
// FORK from : https://github.com/fsharp/FSharp.Data
// --------------------------------------------------------------------------------------
// Helper operations for converting converting string values to other types
// --------------------------------------------------------------------------------------
open System
open System.Globalization
open System.Text.RegularExpressions
@Luiz-Monad
Luiz-Monad / personate.cs
Last active January 24, 2020 02:07
windows privilege descalation
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
public static class MainClazz {
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
static extern bool OpenProcessToken(
IntPtr ProcessHandle,
UInt32 DesiredAccess,
@Luiz-Monad
Luiz-Monad / patch_node_log.js
Last active February 15, 2020 16:21
patch_node_log.js
(() => {
const i = require('inspector')
const l = i.console.log
const w = i.console.warn
const C = console.Console
const c = new C({inspectOptions: {depth: 0}, stdout: console._stdout, stderr: console._stderr})
c.Console = C
c.log = (...a) => { l.apply(i, a); C.prototype.log.apply(c, a) }
c.warn = (...a) => { w.apply(i, a); C.prototype.warn.apply(c, a) }
console.log = c.log