Skip to content

Instantly share code, notes, and snippets.

@assafmo
assafmo / 1_curl_tor.sh
Last active April 4, 2024 19:45
Use curl with TOR as proxy
#!/bin/bash
# Install
sudo apt install -y tor
# Use
curl --proxy socks5h://localhost:9050 https://check.torproject.org
@assafmo
assafmo / index.html
Last active March 28, 2024 15:24
SEO
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- SEO Title -->
<meta name="application-name" content="$SHORT_TITLE" />
<meta name="title" content="$TITLE" />
@assafmo
assafmo / main.ts
Created March 19, 2024 09:31
Manually send an IBC timeout
// Run this code with `ts-node main.ts`
import { IbcClient, Link } from "@confio/relayer";
import { stringToPath } from "@cosmjs/crypto";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { GasPrice } from "@cosmjs/stargate";
import Long from "long";
import { fromHex } from "secretjs";
export async function createIbcConnection(): Promise<Link> {
#!/bin/bash
# https://gist.github.com/assafmo/01d7ee0d131a99518d2a4189a9250460
BLOCK_WINDOW="${1}" # e.g. 100000 blocks in the past
UPGRADE_TIME="${2}" # e.g. 2023-03-02T19:07:13Z
LCD="${3}" # e.g. https://lcd.secret.express or https://api.pulsar.scrttestnet.com
LATEST="$(curl -s "$LCD/cosmos/base/tendermint/v1beta1/blocks/latest")"
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7f12160ac000 pc=0x7f125f3d931f]
runtime stack:
runtime.throw({0x1c913b1?, 0x7f125f3d92d6?})
/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0x7f12168aacd0 sp=0x7f12168aaca0 pc=0x44189d
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:819 +0x369 fp=0x7f12168aad20 sp=0x7f12168aacd0 pc=0x458389
goroutine 1 [syscall]:
runtime.cgocall(0x187fe50, 0xc004846138)
/usr/local/go/src/runtime/cgocall.go:158 +0x5c fp=0xc0048460a0 sp=0xc004846068 pc=0x40b79c
import {
BroadcastMode,
coinsFromString,
SecretNetworkClient,
Wallet,
} from "secretjs";
import { BaseAccount } from "secretjs/dist/grpc_gateway/cosmos/auth/v1beta1/auth.pb";
import { AminoWallet } from "secretjs/dist/wallet_amino";
function sleep(ms: number) {
@assafmo
assafmo / Caddyfile
Last active October 19, 2022 15:13
caddy conf for reverse proxy
banana.com
header {
Access-Control-Allow-Origin *
Access-Control-Allow-Methods *
Access-Control-Allow-Headers *
}
@corspreflight {
method OPTIONS
@assafmo
assafmo / when_last_block.sh
Created October 11, 2022 08:57
Last block
watch $'curl -s localhost:26657/status |
jq .result.sync_info.latest_block_time |
perl -pe "s/\.\d+Z/Z/" |
jq -r \'"Last block: " + (now - (. | fromdate) | floor | tostring) + " seconds ago"\''
@assafmo
assafmo / shockwave-alpha.sh
Last active April 11, 2022 17:45
Launching a new local testnet
SGX_MODE=SW SCRT_SGX_STORAGE="$(pwd)/.sgx_secrets" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(pwd)" RUST_BACKTRACE=1 ./secretd --home "$(pwd)/.secretd" tx gov submit-proposal software-upgrade v1.3 --upgrade-height 28100 --title hi --description bye --deposit 10000000uscrt -y --from a
SGX_MODE=SW SCRT_SGX_STORAGE="$(pwd)/.sgx_secrets" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(pwd)" RUST_BACKTRACE=1 ./secretd --home "$(pwd)/.secretd" tx gov vote 1 yes --from a -y
@assafmo
assafmo / ad7.js
Last active March 21, 2022 06:31
Donwload english subs from addic7ed
#!/usr/bin/env node
// Newest version is in https://github.com/assafmo/ad7
// Install: sudo npm install -g addic7ed-api
// Usage: node ad7.js "the flash" 4 8
// Usage 2: chmod +x ad7.js; ./ad7.js "the flash" 4 8
// Usage 3: chmod +x ad7.js; mv ad7.js /usr/local/bin/ad7; ad7 "the flash" 4 8
// Usage 4: seq 1 4 | xargs -n 1 ad7 "the flash" 4