Skip to content

Instantly share code, notes, and snippets.

@samtay
samtay / example-panic.rs
Created July 12, 2020 23:31
Demonstration of termimad panic
use crossterm::{execute, style::Color::*, terminal};
use std::io::Write;
use termimad::*;
static MD: &str = r#"
You are conflating a few concepts.
[Concurrency is not parallelism](https://stackoverflow.com/q/1050222/155423), and `async` and `await` are tools for *concurrency*, which may sometimes mean they are also tools for parallelism.
Additionally, whether a future is immediately polled or not is orthogonal to the syntax chosen.
@samtay
samtay / RadioPublic.opml
Created July 13, 2020 23:49
Radio Public Export
<?xml version='1.0' encoding='UTF-8' standalone='no' ?>
<opml version="2.0">
<head>
<title>RadioPublic</title>
<dateCreated>Jul 12, 2020 8:20:23 PM</dateCreated>
</head>
<body>
<outline text="America Dissected: Coronavirus " title="America Dissected: Coronavirus " type="link" xmlUrl="http://feeds.feedburner.com/america-dissected" />
<outline text="Crooked Minis" title="Crooked Minis" type="link" xmlUrl="http://feeds.feedburner.com/crooked-conversations" />
<outline text="Deconstructed with Mehdi Hasan" title="Deconstructed with Mehdi Hasan" type="link" xmlUrl="http://rss.prod.flmcloud.net/deconstructed/podcast.rss" />
use clap::{App, AppSettings, Arg};
fn main() {
let matches = App::new("myprog")
.setting(AppSettings::SubcommandsNegateReqs)
.subcommand(
App::new("config").about("configuration mgmt").arg(
Arg::new("reset")
.short('r')
.about("reset config to defaults"),
@samtay
samtay / sudoku.rs
Created July 10, 2023 18:41
Sudoku ZKP
use sunscreen::{
bulletproofs::BulletproofsBackend,
types::zkp::{BulletproofsField, NativeField},
zkp_program, zkp_var, BackendField, Compiler, Error, ZkpRuntime,
};
#[zkp_program]
fn sudoku_proof<F: BackendField>(
#[public] board: [[NativeField<F>; 9]; 9],
solution: [[NativeField<F>; 9]; 9],
@samtay
samtay / private_tx.sol
Created September 19, 2023 18:08
Parasol - Single Key - Private Tx Example
import "sunscreen/src/FHE.sol";
contract PrivateTxExample {
// Encrypted balances
mapping(bytes => bytes) balances;
constructor() {
// Instantiate our FHE subcontract
fhe = new FHE();
}
@samtay
samtay / private_tx.sol
Created September 19, 2023 18:23
Parasol - Network Key - Private Tx Example
import "sunscreen/src/FHE.sol";
contract PrivateTxExample {
// Encrypted balances
mapping(address => bytes) balances;
constructor() {
// Instantiate our FHE subcontract
fhe = new FHE();
}