Skip to content

Instantly share code, notes, and snippets.

@o-az
o-az / auto-commit.yml
Last active July 19, 2024 10:51
This GitHub Action automatically formats code using Prettier when a pull request is opened or updated. It then commits and pushes the formatted code back to the same PR branch, ensuring consistent code style across contributions without manual intervention.
name: 'Auto Commit Prettier'
on:
pull_request:
branches: ['main']
jobs:
auto-commit:
name: 'Auto Commit'
runs-on: ['ubuntu-latest']
@o-az
o-az / sqlite-60k-rps.md
Created July 17, 2024 00:36
How I squeeze 60k RPS out of SQLite on a $5 VPS
  1. Configuring PRAGMAs. We need to send the following PRAGMA commands right after opening the connection:

PRAGMA journal_mode = WAL;

  • enables write-ahead log so that your reads do not block writes and vice-versa.

PRAGMA busy_timeout = 5000;

  • sqlite will wait 5 seconds to obtain a lock before returning SQLITE_BUSY errors, which will significantly reduce them.

PRAGMA synchronous = NORMAL;

@o-az
o-az / git_fzf_log.fish
Last active July 5, 2024 07:45
search through files in past commits with fzf (fish)
function git-fzf-log
git log --oneline --decorate --color=always | fzf --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \
--header 'Press CTRL-S to toggle sort' \
--preview 'git show --color=always {+1}' | awk '{print $1}'
end
git-fzf-log | xargs -I % git diff %^ %

onNavigate, onMount, onDestroy, and beforeUpdate run in a specific order

example:

<script lang="ts">
  import { onNavigate } from '$app/navigation'
  import { onMount, onDestroy, beforeUpdate, tick } from 'svelte'

  beforeUpdate(async () => {
 console.info('beforeUpdate - tick')
@o-az
o-az / github-username-regex.mjs
Last active June 16, 2024 15:46
GitHub username regex: /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}(-?)?$/i
import assert from 'node:assert'
/**
* Run with `node github-username-regex.mjs` or `npx tsx github-username-regex.mjs`
*/
/**
* 1-39 characters
* case insensitive alphanumeric + hyphen
* cannot start with hyphen
@o-az
o-az / github-username-regex.mjs
Created June 16, 2024 15:43
GitHub username regex
/**
* Run with `node github-username-regex.mjs` or `npx tsx github-username-regex.mjs`
*/
import assert from 'node:assert'
const pattern = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}(-?)?$/i
const cases = [
{ value: "", valid: false },
@o-az
o-az / svelte-web3-apps.md
Last active May 21, 2024 03:36
A list of OSS Svelte-based web apps. Reply with a source code link and I will update the list
@o-az
o-az / hide-godaddy.js
Created May 16, 2024 09:45
Hide godaddy in https://ens.app with this userscript
// ==UserScript==
// @name hide-godaddy
// @namespace http://tampermonkey.net/
// @version 2024-05-10
// @description Remove GoDaddy ad from ens.app
// @author https://github.com/o-az
// @match https://ens.app
// @match https://app.ens.domains
// @icon https://www.google.com/s2/favicons?sz=64&domain=ens.domains
// @grant none
diff --git a/node_modules/@cosmjs/amino/build/pubkeys.js b/node_modules/@cosmjs/amino/build/pubkeys.js
index e9844ef..86101f8 100644
--- a/node_modules/@cosmjs/amino/build/pubkeys.js
+++ b/node_modules/@cosmjs/amino/build/pubkeys.js
@@ -9,6 +9,10 @@ function isSecp256k1Pubkey(pubkey) {
return pubkey.type === "tendermint/PubKeySecp256k1";
}
exports.isSecp256k1Pubkey = isSecp256k1Pubkey;
+function isBn254Pubkey(pubkey) {
+ return pubkey.type === "tendermint/PubKeyBn254";
@o-az
o-az / css.css
Last active April 21, 2024 05:45
A collection of useful CSS styles
blockquote::before {
content: open-quote;
}
blockquote::after {
content: close-quote;
}
.element {
z-index: calc(infinity);