Skip to content

Instantly share code, notes, and snippets.

View nikhedonia's full-sized avatar
💭
actively open-sourcing

Gaetano Checinski nikhedonia

💭
actively open-sourcing
View GitHub Profile
@nikhedonia
nikhedonia / EitherAsmAnalysis.cpp
Created May 16, 2017 11:39
analysing Assembly generated by Eithers
#include <type_traits>
template<class L>
struct Left {
L const value;
};
template<class R>
struct Right {
R const value;
// Type definitions
type BinaryOP =
| Add
| Sub
| Div
| Mult
type Expr< ^T> =
| Binary of BinaryOP * Expr< ^T> * Expr< ^T>
| Value of ^T
type ^T Dual
when ^T: (static member (+): ^T * ^T -> ^T)
and ^T: (static member (-): ^T * ^T -> ^T)
and ^T: (static member (*): ^T * ^T -> ^T)
and ^T: (static member (/): ^T * ^T -> ^T)
(real: ^T, imag: ^T) =
member inline this.x = real
member inline this.y = imag
static member inline (+) (lhs: Dual< ^T>, rhs: Dual< ^T>) =
@nikhedonia
nikhedonia / denormalized.js
Last active March 16, 2020 10:56
tests normalized vs denormalized+gzip data
const {writeFileSync} = require('fs');
const { normalize, schema } = require('normalizr');
const faker = require('faker');
const murmur = require("murmurhash-js");
const genId = (data) => murmur(JSON.stringify(data));
// Define a users schema
const user = new schema.Entity('users', undefined, {
idAttribute: genId
@nikhedonia
nikhedonia / request_over_tor.js
Created December 28, 2017 16:16
sending a request over tor and renew ip
var Https = require('socks5-https-client/lib/Agent');
var Http = require('socks5-http-client/lib/Agent');
var openports = require('openports');
var net = require('net');
var tmp = require('tmp');
var request = require('request');
const { spawn } = require('child_process');
function spawnTor(port, port2) {
const tmpobj = tmp.dirSync();

Keybase proof

I hereby claim:

  • I am nikhedonia on github.
  • I am nikhedonia (https://keybase.io/nikhedonia) on keybase.
  • I have a public key ASBu9ecCWZVB-9qRvRf9spFQthdecGFP8m5Uh8ejopz4EQo

To claim this, I am signing this object:

#include <iostream>
#include <optional>
struct Unit{};
struct Entry {
auto operator()(){
return std::optional<Unit>{};
}
provider "aws" {
region = "eu-west-1"
}
terraform {
backend "s3" { # will handle correctly multiple workspaces
bucket = "project"
region = "eu-west-1"
key = "project/terraform.tfstate"
dynamodb_table = "project-terraform-lock" # to prevent race conditions, table needs to be created manually
int main () {
  int n=100;
  auto prevRatio = 0.0;
  for (auto ratio: fibRatios()) {
  cout << ratio << endl;
  auto delta =  ratio - prevRatio;
  if (n==0 || delta < 0.0001)
  break;
  prevRatio = ratio;
  n- - ;
int main() {
int i = 0;
for (auto x: fibRatios()) {
cout << x << endl;
if(++i != 10) break;
}
}