Skip to content

Instantly share code, notes, and snippets.

@MicahZoltu
MicahZoltu / script.bash
Last active March 18, 2024 14:46
Generate Ethereum Mnemonic & Address
mkdir temp
cd temp
cat >index.mjs <<'EOF'
import { ethereum, mnemonic, secp256k1, hdWallet } from '@zoltu/ethereum-crypto'
// necessary so @peculiar/webcrypto looks like browser WebCrypto, which @zoltu/ethereum-crypto needs
import webcrypto from '@peculiar/webcrypto'
globalThis.crypto = new webcrypto.Crypto()
export async function generateAccount() {
@MicahZoltu
MicahZoltu / standard-notes-proxy.js
Created March 11, 2024 03:04
Standard Notes CloudFlare Proxy
export default {
/**
* @param {Request} request
*/
async fetch(request) {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
"Access-Control-Max-Age": "86400",
};
@MicahZoltu
MicahZoltu / tornado-community-build.md
Last active July 18, 2023 22:00
Tornado Cash Community Build
@MicahZoltu
MicahZoltu / vitalik-mode.js
Last active June 14, 2023 08:54
vitalik-mode
(function () {
var request = async ({method, params}) => {
if (method === 'eth_requestAccounts') {
return ['0xd8da6bf26964af9d7eed9e03e53415d37aa96045']
}
else {
const response = await fetch('https://cloudflare-eth.com/v1/mainnet', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({jsonrpc:'2.0',id:1,method,params})})
if (!response.ok) throw new Error(`${response.status}: ${response.statusText}\n${await response.text()}`)
const json = await response.json()
if ('error' in json) throw new Error(json.error)
@MicahZoltu
MicahZoltu / faster.js
Created June 2, 2023 11:07
Faster Video Playback Bookmarklet
javascript:(() => { let speed = 2; let indicator; let indicatorTimeout; function createIndicator() { indicator = document.createElement("div"); indicator.setAttribute(`style`, ` position: fixed; left: 15px; top: 15px; background-color: black; color: white; font-size: 20px; padding: 10px; display: none; z-index: 99999999999999; `); document.body.appendChild(indicator); }; function show(text) { if (!indicator) createIndicator(); indicator.innerText = text; indicator.style.display = "block"; indicatorTimeout && clearTimeout(indicatorTimeout); indicatorTimeout = setTimeout(() => { indicator.style.display = "none"; }, 5000); } function round(value, precision) { const scalar = 10 ** precision; return Math.round(value * scalar) / scalar; }; function conformSpeed(value) { return Math.min(Math.max(value, 1 / 16), 16); }; function syncSpeed() { document.querySelectorAll("video").forEach(video => { video.playbackRate = speed; }); }; function changeSpeed(value) { speed = conformSpeed(value); show(round(speed, 2).t
@MicahZoltu
MicahZoltu / zoom-fix-chat.js
Created July 15, 2022 14:43
Fix Zoom Chat Box Focus bug
(function () { const chatBox = document.querySelector('#wc-container-right > div.participants-section-container > div.chat-container > div > textarea'); chatBox.onblur = chatBox.focus })()
@MicahZoltu
MicahZoltu / Readme.md
Last active April 27, 2022 16:37
Skyrim Auto-Level Crafting Mod
  1. Install Creation Kit (via Bethesda Launcher).
  2. File > Data > Skyrim.esm
  3. Character > Quests > right click anywhere on right > New
  4. Assign ID, Quest Name, check Start Game Enabled and Run Once
  5. Click OK
  6. Double click new quest in list.
  7. Scripts > Add > New Script
  8. Assign name, Extends Quest, Hidden, OK
  9. Right click script > Edit Source
  10. Paste source.
@MicahZoltu
MicahZoltu / discord.js
Last active October 21, 2021 08:18
Reaction Hotkey for various chat clients.
window.addEventListener('keydown', event => {
if (!event.shiftKey || !event.ctrlKey || event.key != '|') return
const container = document.querySelector('main > div:first-of-type > div:first-of-type > div:first-of-type > ol > li:last-of-type > div')
container.dispatchEvent(new MouseEvent('mousemove', { bubbles: true }));
container.querySelector('div[aria-label="Add Reaction"]').click()
})
@MicahZoltu
MicahZoltu / github-widescreen-bookmarklet.js
Last active August 30, 2021 07:58
GitHub Widescreen Boookmarklet
javascript:(function(){ const style = document.createElement('style'); style.id = 'injected-css'; style.innerText = `.container-xl, #review-changes-modal .SelectMenu-modal, .inline-comment-form-container, .inline-comment-form, .comment-holder, #pull_request_review_body { max-height: none !important; max-width: none !important; } .js-resolvable-timeline-thread-container, .js-line-comments { max-width: calc(100vw - 100px); }`; document.head.appendChild(style); })();
@MicahZoltu
MicahZoltu / markdown.md
Last active March 2, 2021 22:39
Trusted Anonymous DAO

Trusted Anonymous DAO

The goal of this process is to create a DAO that the public can weakly trust, while protecting DAO participants from wrench attacks by someone looking to takeover the DAO.

Process

  1. A secret is given out to n publicly trusted individuals.
  2. The individual's with secrets are instructed to secretly nominate one person they trust to participate in the DAO.
  3. The nominated individuals all sign the secret and publish the signature plus the address they signed with publicly (and anonymously).
    1. Nominated individuals should accept multiple nominations if offered, and not tell anyone they were nominated multiple times.
    2. Nominated individuals are strongly encouraged to participate, but they should not inform their nominator if they fail to participate.
  4. After a pre-defined amount of time has passed, all valid signatures (verifiable by anyone who has seen the secret) are collected and the trusted individuals all assert that: