Skip to content

Instantly share code, notes, and snippets.

View marcoonroad's full-sized avatar
🦋
the Future() has been CANCELLED and we .Restart() the DEAD Event[] from the past

Marco Aurélio da Silva marcoonroad

🦋
the Future() has been CANCELLED and we .Restart() the DEAD Event[] from the past
View GitHub Profile
@rochacbruno
rochacbruno / validate_dataclass.py
Created September 30, 2021 11:13
Validate Dataclass Python
from typing import Union, List
from dataclasses import dataclass
class Validations:
def __post_init__(self):
"""Run validation methods if declared.
The validation method can be a simple check
that raises ValueError or a transformation to
@allenhwkim
allenhwkim / clock.svg
Last active April 24, 2023 11:25
Clock SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marcoonroad
marcoonroad / temp-predict.py
Last active September 21, 2020 23:40
Temperature Prediction (Hacker Rank challenge)
#!/usr/bin/env python3
# Challenge available at:
# https://www.hackerrank.com/challenges/temperature-predictions/problem
import pandas
import numpy
count = int(input().strip())
input()

Windows 10 (20H1 / 2004 / Mai 2020 Update) with WSL2 is out, this guide should be obsolete now.

Upgrading an existing WSL1 setup to WSL2

Docker in WSL1

Note, this is only needed on Windows 10 Home and WSL1. If you have Windows 10 Pro, you can run Docker for Windows (https://docs.docker.com/docker-for-windows).

After completing this guide, you will have a Windows 10 Home running the docker deamon via Docker Toolbox / VirtualBox. The WSL guest OS will connect to this docker deamon, and will have the Windows OS filesystem mapped as C:\ -> /c/ instead of C:\ -> /mnt/c/, which will fix path translation between docker deamon on Windows and docker client in WSL guest OS.

@ChristophShyper
ChristophShyper / wsl2-docker.md
Last active January 10, 2023 20:36
Instruction how to set up WSL2 to work with Docker in Windows 10

On Windows 10 build 18917 or higher

Win / Enable WSL and VMP

PowerShell:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform

Win / Set WSL 2 as default

@CarlosLanderas
CarlosLanderas / Program.cs
Created September 29, 2019 19:53
WorkerService + HealthCheck
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Routing;
@kennwhite
kennwhite / powershell_command_urandom.js
Last active July 22, 2023 14:09
Powershell 1-liner to generate random n-byte key from Windows command line
// Windows equivalent to Linux/Mac: echo $(head -c 64 /dev/urandom | base64 | tr -d '\n')
// Get-Random in Windows 10/Server 2016 PowerShell uses a CSPRNG seed by default.
// Prior to PS 5.1, seed was system clock.
// For Win 10/2016+
powershell -command "[Convert]::ToBase64String((1..64|%{[byte](Get-Random -Max 256)}))"
// For Win 8.x/2012
powershell -command "$r=[byte[]]::new(64);$g=[System.Security.Cryptography.RandomNumberGenerator]::Create();$g.GetBytes($r);[Convert]::ToBase64String($r)"
@marcoonroad
marcoonroad / HOMO-HASH-SIGS.md
Created April 1, 2019 01:34
Merkle-less, Homomorphic Hash-based Infinite-time Stateless Digital Signatures

Merkle-less, Homomorphic Hash-based Infinite-time Stateless Digital Signatures

We will use the following terms:

pk   is public key
sk   is private key (secret key)
H    is hash function
sig  is message signature
m is plain-text message
@onderaltintas
onderaltintas / Global.asax
Created May 3, 2018 10:55 — forked from jkresner/Global.asax
Asp .net Mvc 4 Proxy Server/Controller (For help with Cross Domain Request)
public class WebApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
RouteTable.Routes.MapRoute("HttpProxy", "proxy/{*path}", new { controller = "Proxy", action = "Http" })
}
}

CvRDTs are (almost?) as general as they can be

What are you talking about, and why should I care?

Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to