Skip to content

Instantly share code, notes, and snippets.

@stonegao
stonegao / coinswap-design.md
Created April 26, 2024 04:37 — forked from chris-belcher/coinswap-design.md
Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

25/5/2020

Abstract

Imagine a future where a user Alice has bitcoins and wants to send them with maximal privacy, so she creates a special kind of transaction. For anyone looking at the blockchain her transaction appears completely normal with her coins seemingly going from address A to address B. But in reality her coins end up in address Z which is entirely unconnected to either A or B.

Now imagine another user, Carol, who isn't too bothered by privacy and sends her bitcoin using a regular wallet which exists today. But because Carol's transaction looks exactly the same as Alice's, anybody analyzing the blockchain must now deal with the possibility that Carol's transaction actually sent her coins to a totally unconnected address. So Carol's privacy is improved even though she didn't change her behaviour, and perhaps had never even heard of this software.

@stonegao
stonegao / closeAuxAccount.ts
Created April 26, 2024 02:27 — forked from Henry-E/closeAuxAccount.ts
Close aux token account
import * as anchor from "@coral-xyz/anchor";
import { PublicKey, Transaction, ComputeBudgetProgram } from "@solana/web3.js";
import * as token from "@solana/spl-token";
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
// Assumes your running with `anchor run closeAux --provider.cluster mainnet --provider.wallet ~/.config/solana/your-key.json`
const payer = provider.wallet["payer"];
@stonegao
stonegao / gist:a1d2c44814e6ab9689dc3ba712f4b453
Created November 28, 2023 03:05 — forked from levelsio/gist:5bc87fd1b1ffbf4a705047bebd9b4790
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@stonegao
stonegao / EIP138128.md
Created November 6, 2023 09:16 — forked from Shungy/EIP138128.md
EIP138128: Custom selector and encodings (Very early draft)

Using LEB128 encoding scheme for custom abi/interface.

ERC-138128: Custom function selector and calldata encoding scheme declaration standard

  • A contract SHOULD use ERC-165 standard to declare its support for ERC-138128 standard.
  • A contract supporting ERC-138128 MUST have these two view functions: customSelectors() and customEncodings().

customSelectors()

This function is used to declare alternative function selectors for any number of standard function signatures. This function MUST have the following interface.

@stonegao
stonegao / nestjs.Dockerfile
Created October 10, 2023 11:24 — forked from CorneilleEdi/nestjs.Dockerfile
NestJS Dockerfile with multi-stage
FROM node:16-alpine as builder
RUN apk add curl bash
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sfL https://gobinaries.com/tj/node-prune | bash -s -- -b /usr/local/bin
USER node
WORKDIR /home/node
@stonegao
stonegao / fix_exfat_drive.md
Created September 9, 2023 02:09 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@stonegao
stonegao / install_guide.md
Created June 30, 2023 03:34 — forked from teebaumcrypto/install_guide.md
lighthouse & reth install and sync mainnet ethereum

Specs

CPU

  • AMD Ryzen 9 7900X AM5, 4.70 GHz, 12-Core

RAM

  • Corsair 6000-40 Vengeance 2 x 32GB 6000 MHz (DDR5)

Nvme

  • WD Black SN850X 4 TB M.2 2280
@stonegao
stonegao / p2pk.rs
Created June 15, 2023 11:55 — forked from sgeisler/p2pk.rs
// bitcoin = "*"
// bitcoin_hashes = "*"
use bitcoin::{Address, Network, Script};
use bitcoin::util::address::Payload;
use bitcoin::util::psbt::serialize::Deserialize;
use bitcoin_hashes::{hash160, Hash};
fn main() {
let bytes: &[u8] = &[
@stonegao
stonegao / interesting_crates.md
Created May 16, 2023 11:59 — forked from vi/interesting_crates.md
List of crates that improves or experiments with Rust, but may be hard to find

Let's list here crates that enhance Rust as a language.

It not "batteries" like in stdx, but Rust-specific crates for workarounds for various missing features and experimental ideals from non-accepted/postponed RFCs, or just hacky tricks.

The list is supposed to contain (mostly) crates that are internal to Rust, not ones for making Rust deal with "external world" like other languages bindings, file formats, protocols and so on.

Primary focus should be on crates that are not easy to find by conventional means (e.g. no algorithm name, format or protocol to search for).

Note that quality of the listed crates may vary from proof-of-concept to stable-and-widely-used.

@stonegao
stonegao / Cargo.toml
Created May 16, 2023 11:59 — forked from LeoDog896/Cargo.toml
Small WebRTC-rs example
[package]
name = "rs-example"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
webrtc = "0.4.0"
tokio = { version = "1.15.0", features = ["full"] }