Skip to content

Instantly share code, notes, and snippets.

@jordwalke
jordwalke / tutorial.md
Created October 2, 2019 20:54
Adding A ReHP backend quick tutorial.

Getting started with adding a backend for Rehp for a new language.

Let me know where you hit friction with these instructions and I'll clarify.

  • Clone rehp
  • grep -r php . to see various references to PHP. That shows you what was done to extend the compiler to add a new backend. You will be doing something very similar. In general, the best way to get started is to copy/paste everything that was done for PHP, to add your new backend.
  • Check out the file compiler/lib/rehp.re This is the new intermediate representation that was added to the jsoo compiler. Rehp uses the bytecode disassembler from jsoo, and instead of turning it into js, it turns it into this other intermediate representation called "Rehp"- which is defined bycompiler/lib/rehp.re`.
  • Add your backend to compiler/lib/backend.ml/i including info about the file extension.
  • Add a new file compiler/lib/YourLang.re, which can start out as a copy of the compiler/lib/php.re file. This represents the
@wokalski
wokalski / Ppx_driver_with_bucklescript.md
Created August 26, 2019 07:38
How to run a driver based ppx with bucklescript
  1. Create a dune file:
(library
 (public_name aggregate_ppx_name)
 (kind ppx_rewriter)
 (libraries ppx_deriving_protobuf other_ppx another_ppx))
  1. Build:
dune build --profile release
@dhil
dhil / y.ml
Last active January 28, 2023 03:44
Typing the Y combinator in OCaml.
(* Typing the Y combinator in OCaml.
* $ ocaml y.ml
720
Succ(Succ(Succ(Succ(Succ(Succ(Zero))))))
*)
type 'a fix = Fix of ('a fix -> 'a)
let fix x = Fix x
let unfix (Fix x) = x
@573
573 / readme.md
Last active January 20, 2024 21:02
nix complains "error: cannot auto-call a function that has an argument without a default value ('stdenv')"?

Add on top of default.nix: with import {}; or simply run as nix-build '' (i. e. for nix-build complaining) or rather nix-build -E 'with import {}; callPackage ./default.nix {}' (or even import)

@lpalmes
lpalmes / react.md
Last active May 7, 2021 17:59
React and Reconcilers in Reason

React

This is the base of all projects and it will include the foundation for all potential react-based projects in Reason.

This base package should include a ReasonReact api to promote collaboration and familiarity with people using a ReasonReact, and for the modern world of React this should also include a Hooks api that currently revery uses.

React module

All blocks in Jsx are of type React.reactElement. This reactElement should represent:

@nadavrot
nadavrot / Matrix.md
Last active May 19, 2025 10:19
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@dvdknaap
dvdknaap / kali.md
Last active October 16, 2024 16:54
RootTricks

install all tools

  • apt install kali-linux-all

.git folder downloader

  • git clone https://github.com/internetwache/GitTools.git

Check ports with nmap

  • nmap -sC -sV -oA initial 10.10.10.78
  • nmap -sV -sC -oA nmap-tcp 10.10.10.84
  • nmap -T4 -A -v -p 0-10000 10.10.10.8
@chairco
chairco / nodejs-ubuntu-bind-port-80.md
Created March 21, 2018 02:52 — forked from drawveloper/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@klali
klali / engine.py
Last active March 18, 2024 19:50
sample for using a yubihsm2 with python requests
try:
from OpenSSL._util import (
ffi as _ffi,
lib as O,
lib as S
)
pyopenssl = True
import sys
@freman
freman / evalmyoutput.sh
Created September 6, 2017 23:36
Re-create docker iptables rules
#!/bin/bash
echo "Recreating docker iptables rules and chains"
echo "iptables -N DOCKER"
echo "iptables -N DOCKER-ISOLATION"
echo "iptables -t nat -N DOCKER"
echo "iptables -A DOCKER-ISOLATION -j RETURN"
echo "iptables -A FORWARD -j DOCKER-ISOLATION"
echo "iptables -t nat -A PREROUTING -m addrtype -dst-type LOCAL -j DOCKER"