Skip to content

Instantly share code, notes, and snippets.

@doutv
doutv / smms_storage.py
Created April 6, 2022 01:28
Django custom backend storage for sm.ms image hosting service 图床
from django.core.files.storage import Storage
from django.conf import settings
from django.utils.deconstruct import deconstructible
import requests
from django.core.files import File
import logging
logger = logging.getLogger(__name__)
@doutv
doutv / db.py
Created June 26, 2023 07:42
SeeDAO翻译公会:翻译库归档->统计贡献榜
# %%
import pandas as pd
df = pd.read_csv('db.csv')
# print(df.head())
print(df.columns)
# %%
df = df[["翻译","校对","信源","状态"]]
# remove trailing spaces from all columns
@doutv
doutv / circom-example.md
Last active July 10, 2023 03:27
Circom Example

This program proves that I know 2 secret inputs a and b, such that a*b=c, c is a public value.

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:0ed578125b251ff555d1bdbbef62036a";

@doutv
doutv / zk-mnist.circom
Last active July 10, 2023 03:26
zk-mnist circom
pragma circom 2.0.1;
include "https://github.com/iden3/circomlib/blob/master/circuits/comparators.circom";
include "https://github.com/iden3/circomlib/blob/master/circuits/switcher.circom";
template ArgMax (n) {
signal input in[n];
signal output out;
component gts[n]; // store comparators
component switchers[n+1]; // switcher for comparing maxs
@doutv
doutv / r1cs_wtns_to_dizk.py
Created July 31, 2023 07:35
Translate R1CS .r1cs and witness .wtns to DIZK JSON format
import json
from operator import is_not
from functools import partial
name = input("Enter filename: ")
with open(f"{name}.r1cs.json", "r") as f:
r1cs = json.load(f)
with open(f"{name}.wtns.json", "r") as f:
wtns = json.load(f)
@doutv
doutv / checkout.yml
Last active April 18, 2024 13:19
GitHub Actions Pull Private Git Submodule
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone main repository
uses: actions/checkout@v4
- name: Add SSH private keys for submodule repositories
uses: webfactory/ssh-agent@v0.9.0