This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use winter_math::{FieldElement, fields::f64::BaseElement as Felt}; | |
use winter_prover::{Prover, Trace}; | |
/* +---+---+ Fibonacci: 2 columns per row. | |
| a | b | Single column fibonacci is not possible with this constraint system as that would require looking back more than previous time step. | |
+---+---+ Transition constraints: | |
| c | d | c = a + b | |
+---+---+ d = b + c */ | |
fn main() { | |
let (f0, f1) = (Felt::new(1), Felt::new(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to use: | |
# 1. Make sure you have nix installed (https://nix.dev/install-nix) | |
# 2. Download this file, and name it for example `fireblocks-mpc-lib-wasm32-wasi.nix` | |
# 3. Run `nix-shell fireblocks-mpc-lib-wasm32-wasi.nix`. | |
# 4. Run `wasitest` inside the nix-shell environment to run the paillier benchmark. | |
{ pkgs ? import (builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/51d906d2341c9e866e48c2efcaac0f2d70bfd43e.tar.gz"; | |
sha256 = "16nmvxfiyna5y9gwd2i3bhkpbn0nn37i481g53zc0ycw67k268sv"; | |
}) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To get started: | |
# 1. Copy this into a file called `shell.nix` locally | |
# 2. Install nix (https://nix.dev/tutorials/install-nix) | |
# 3. Type nix-shell --run "jupyter lab" | |
# 4. Create a new Python notebook by clicking on the button in the browser UI | |
# 5. Put `import eth2spec.capella` into a cell and press Shift+Enter | |
# 6. Put `eth2spec.capella.mainnet.BeaconBlock()` into the next cell and press Shift+Enter | |
{ pkgs ? import (fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install pyserial==3.5 logic2-automation==1.0.6 | |
from saleae import automation | |
import serial | |
import time | |
# Make sure that this is accessible to your Linux user. It probably isn't. | |
# Run `sudo chmod a+rw /dev/ttyUSB1` to allow everyone on the machine access. | |
tty = serial.Serial('/dev/ttyUSB1') # UART over USB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pyopencl as cl | |
import matplotlib.pyplot as plt | |
import cv2 | |
W, H = (1500, 1500) | |
(cxmin, cxmax), (cymin, cymax) = ((-1.5, 1.5), (-1.5, 1.5)) | |
duration, fps = (10, 25) | |
frame_count = int(fps * duration) | |
cx, cy = np.meshgrid(np.linspace(cxmin, cxmax, W, dtype=np.float32), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ids] | |
* | |
[main] | |
` = macro(S-= space) | |
[shift] | |
4 = S-A-4 | |
[meta] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These require compiler support for statement expressions (https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html) | |
#define assert_ok(e) ({int x = (e); if (x < 0) { printf("%s:%d: ", __FILE__, __LINE__); fflush(stdout); perror(#e); abort(); } x;}) | |
#define assert_ptr(e) ({void* p = (e); if (p == NULL) { printf("%s:%d: %s: NULL pointer returned\n", __FILE__, __LINE__, #e); abort(); } p;}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
build_and_run() { | |
cc main.c -o main -Wall -Wextra | |
./main | |
} | |
trap 'kill "$p" >/dev/null 2>/dev/null' INT | |
build_and_run & | |
p=$! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pip_index_url="example.com/pypi" | |
private_package="myprivatepackage" | |
personal_access_token="$1" | |
curl -k -s -L -o/dev/null -w"%{http_code}" --url "https://$pip_index_url/$private_package" --header "Authorization: Basic $(printf '%s' "$personal_access_token:" | base64)" | |
# To configure pip to use registry: | |
# export PIP_EXTRA_INDEX_URL="https://$personal_access_token@$pip_index_url" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.core.magic import register_cell_magic | |
import multiprocessing as mp | |
from functools import wraps | |
import importlib.util | |
import traceback | |
import sysconfig | |
import tempfile | |
import secrets | |
import sys | |
import os |
NewerOlder