Skip to content

Instantly share code, notes, and snippets.

View crazyoptimist's full-sized avatar
🐌
crawling

crazyoptimist crazyoptimist

🐌
crawling
View GitHub Profile
@crazyoptimist
crazyoptimist / CLAUDE.md
Last active September 7, 2026 17:31
CLAUDE Config for using Foundry Cast

foundry-cast

Wallet operations (balance checks, transfers) using Foundry's cast CLI, based on: https://gist.github.com/crazyoptimist/232febf49ad0df9f039f9789b91129f1

Wallet

  • Keystore name: main (file: ~/.foundry/keystores/main, use with --account main)
  • "main" wallet address: 0xFaF2D6577eFDeC875cbcbcf930fe10c8fC547799
  • Password is NOT stored anywhere. cast send --account main ... prompts for the
@crazyoptimist
crazyoptimist / foundry-cast-wallet-guide.md
Last active September 7, 2026 17:12
Using `cast` (Foundry) as a Hot Wallet — ETH, USDT-ERC20, USDT-BEP20

Using cast (Foundry) as a Hot Wallet — ETH, USDT-ERC20, USDT-BEP20

cast only works with EVM-compatible chains, which covers Ethereum and BNB Smart Chain (ETH, USDT-ERC20, USDT-BEP20). TRON (USDT-TRC20) is not EVM-compatible and cannot be used with cast.

Security note: A keystore/hot wallet on a general-purpose machine is meaningfully riskier than hardware signing. For anything beyond small, disposable amounts, pair cast with a hardware wallet instead of a raw private key — most cast wallet commands (send, wallet address, wallet list, etc.) support -l/--ledger and -t/--trezor flags. Always verify RPC endpoints and token contract addresses before broadcasting, and test with tiny amounts first.

1. Install Foundry (includes cast)

curl -L https://foundry.paradigm.xyz | bash
@crazyoptimist
crazyoptimist / config.def.h
Created November 6, 2024 15:16
DWM Color Scheme - Gruvbox Dark
// ... snip ...
/* https://github.com/morhetz/gruvbox */
static const char col_normfg[] = "#fbf1c7"; /* fg0 */
static const char col_normbg[] = "#282828"; /* bg0 */
static const char col_normborder[] = "#504945"; /* bg2 */
static const char col_selfg[] = "#1d2021"; /* bg0_h */
static const char col_selbg[] = "#98971a"; /* green */
static const char col_selborder[] = "#b8bb26"; /* light green */
@crazyoptimist
crazyoptimist / clean-architecture-summary.md
Created October 17, 2024 09:02
Clean Architecture Summary (Note to myself)

Uncle Bob

  • The goal of software architecture is to minimize the human resources required to build and maintain the required system.
  • The only way to go fast, is to go well.
  • Any organization that designs a system will produce a design whose structure is a copy of the organization's communication structure. (Conway's law)

SOLID

  • SRP: Each software module has one, and only one, reason to change. (This is NOT "A function should do one, and only one, thing, and do it well.") A module should be responsible to one, and only one, actor. (actor == user or stakeholder)

  • OCP: For software systems to be easy to change, they must be designed to allow the behavior of those systems to be changed by adding new code, rather than changing existing code. A software artifact should be open for extension but closed for modification.

@crazyoptimist
crazyoptimist / login.js
Last active October 3, 2024 19:59
Postman Script for JWT Login
// Locate the "Scripts" tab in Postman. Select "Post-response" left side tab. Copy, paste, and edit this script.
const jsonData = pm.response.json()
// Make sure necessary variables exist in the response
pm.test("Access Token exists", function () {
pm.expect(jsonData.access_token).to.not.equal(undefined);
});
pm.test("Refresh Token exists", function () {
pm.expect(jsonData.access_token).to.not.equal(undefined);
@crazyoptimist
crazyoptimist / select-usage.md
Last active November 5, 2024 16:24
How to use select in Go

In Go, the select statement is used to handle multiple channel operations and simplify concurrent communication and synchronization problems. The select statement is similar to the switch statement, but each case must be a channel operation.

Basic syntax of the select statement:

select {
    case <-chan1:
        // Executed when chan1 has data to receive
    case chan2 <- value:
        // Executed when data can be sent to chan2
@crazyoptimist
crazyoptimist / self-sign.ps1
Last active August 6, 2024 07:45
Generate a self-signed certificate and sign your windows binaries with it.
; Credits: https://www.the-automator.com/
; Create certificate
$cert = New-SelfSignedCertificate -Subject "{CertName}" -CertStoreLocation "cert:\CurrentUser\My" -HashAlgorithm sha256 -type CodeSigning
; Create password
$pwd = ConvertTo-SecureString -String "{123456}" -Force -AsPlainText
; Export Certificate to a file
Export-PfxCertificate -cert $cert -FilePath {CertName}.pfx -Password $pwd
@crazyoptimist
crazyoptimist / recover.go
Created July 31, 2024 20:05
Guide on using recover()
package main
import (
"fmt"
"time"
)
var index int = 0
func main() {
@crazyoptimist
crazyoptimist / timezone-guide.go
Created July 25, 2024 17:24
Guide for using time zone in go.
package main
import (
"fmt"
"time"
_ "time/tzdata" // Embed the timezone database
)
func main() {
utcTime := time.Date(2024, time.Now().Month(), 26, 1, 30, 0, 0, time.UTC)
@crazyoptimist
crazyoptimist / prompt.sh
Created March 14, 2024 07:39
Minimal Bash Prompt
# new line + workdir + $
export PS1="\n\w $ "
export PROMPT_DIRTRIM=2