Skip to content

Instantly share code, notes, and snippets.

@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();
}
@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 / 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],
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 / 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" />
@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 / homework.sty
Last active April 2, 2020 21:50
CSE 546 hw template
\usepackage{fancyhdr}
\usepackage{extramarks}
\usepackage{amsmath}
%\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
\usepackage{physics}
@samtay
samtay / stack-ghcid.zsh
Created April 18, 2019 17:51
Forward `stack ghci` completions to `ghcid -c 'stack ghci...'`
stack-ghcid()
{
ghcid -c 'stack ghci '"$@"''
}
_stack-ghcid()
{
local CMDLINE
local IFS=$'\n'
export COMP_LINE="${COMP_LINE/stack-ghcid/'stack ghci'}"
@samtay
samtay / better_surfline.js
Last active October 14, 2020 05:02
Reveal more forecast data
// ==UserScript==
// @name Free Surfline Forecasts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Unblurr restricted forecast data. They are dumb enough to actually put the real data in the DOM.
// @author samtay
// @match http*://www.surfline.com/*
// @grant none
// ==/UserScript==
@samtay
samtay / better_indeed.js
Created July 24, 2017 02:22
Better Indeed Results (filter sponsored)
// ==UserScript==
// @name Better Indeed
// @version 0.1
// @description Ignores sponsored links
// @author samtay
// @match http*://www.indeed.com/*
// @grant none
// ==/UserScript==
(function() {