Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@kobigurk
kobigurk / BLS_with_help.sol
Created August 25, 2020 15:51
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=false&gist=
pragma solidity ^0.5.15;
contract BLS {
// Field order
uint256 constant N = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
// Negated genarator of G2
uint256 constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
uint256 constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
uint256 constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052;
# nim c -r --threads:on --gc:orc
import cpuinfo, os, random, locks, deques
type
WorkReq = ref object
id: int
WorkRes = ref object
id: int
import math, random
proc gauss(mu = 0.0, sigma = 1.0): float =
var
s = 0.0
u = 0.0
v = 0.0
while s > 1 or s == 0:
u = 2.0 * rand(1.0) - 1.0
v = 2.0 * rand(1.0) - 1.0
@tqinli
tqinli / pthread_cond_repro.c
Last active February 24, 2023 22:52
A repro for pthread_cond_wait/signal's issue of losing signal
// To compile
// gcc -g -o pthread_cond_repro ./pthread_cond_repro.c -lpthread
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <assert.h>
@CumpsD
CumpsD / dontfeedthebeast.md
Created February 11, 2020 15:55 — forked from anonymous/dontfeedthebeast.md
Don’t Feed the Beast – the Great Recruitment Agency Infestation

Don’t Feed the Beast – the Great Recruitment Agency Infestation

“Don’t move to that London” warned my northern grandfather once. “It’s full of spivs”.

The Oxford Dictionary (somewhat chauvinistically) defines a spiv as:

A man, typically a flashy dresser, who makes a living by disreputable dealings

“But I work in IT” I told him. “engineers aren’t like that”.

@goranmoomin
goranmoomin / issue-log-83.md
Last active December 3, 2020 11:34
actix-service Cell::get_mut() is unsound
@bb010g
bb010g / 000-actix-logs
Last active November 9, 2022 06:53
actix/actix-net#83, actix/actix-net#87
.

Twisted Edwards & Short Weierstrass Equivalence

Putting this here since I don't see it documented anywhere in the literature.

Note that your Short Weierstrass curve must have 2-torsion.

1. Short Weierstrass -> Twisted Edwards

s = sqrt(3 * r^2 + a)
@protolambda
protolambda / experimental.go
Last active November 11, 2019 23:27
Binary Tree as immutable state backing, with rebinding pattern for minimal copy-on-write modifications. Every merkle cached *by default*.
package main
import (
"crypto/sha256"
"encoding/binary"
"fmt"
"github.com/protolambda/zrnt/eth2/core"
"log"
)
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active May 12, 2025 14:47
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !