Skip to content

Instantly share code, notes, and snippets.

@johnrees
johnrees / cheeto.js
Last active December 23, 2023 02:29
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function () {
const speed = 1; // Adjust for faster or slower movement
const container = document.createElement("div");
container.style.position = "fixed";
container.style.top = 0;
container.style.bottom = 0;
container.style.left = 0;
container.style.right = 0;
// go to following or followers page
let values = new Set([]);
let height = 0;
function scroll() {
if (height < document.body.scrollHeight) {
height = document.body.scrollHeight;
window.scrollTo(0, height);
setTimeout(scroll, 2000);
[
@johnrees
johnrees / avatars.ts
Last active February 18, 2022 05:49
anchor viz
import axios from "axios";
import { createWriteStream } from "fs";
import { resolve } from "path";
async function downloadImage(url, filename) {
const path = resolve(__dirname, "../avatars", filename);
const response = await axios({
method: "GET",
url,
responseType: "stream",
on:
release:
types:
- published
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- uses: ethomson/send-tweet-action@v1
with:
const {
getHashedName,
getNameAccountKey,
NameRegistryState,
} = require("@solana/spl-name-service");
const {
Connection,
clusterApiUrl,
PublicKey,
@johnrees
johnrees / example-request.sh
Last active September 12, 2021 19:31
caching test
curl https://rpc.goo.tools -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ",
{
"dataSlice": { "offset": 0, "length": 0 }
}
name mint_address
Ape #91 FUcUDinc5nvCzkt3CRRzYbbWaXpCJzD6CogUn8zp2jC8
Ape #143 Fk2Pdz9kJFm6AHoKs75y35Sr7nmMY93EMrwjXk4Zybs1
Ape #148 CkExwWKgapXYaYpWEFug4Ezba9EXWBTJ3fgcofhRrLC7
Ape #156 3Nxp3oXqY6YVZkPfQXk9iDjdvUcNZM6Wp6bPWrdHc5Jk
Ape #178 5bzsQ17MsQrAuPZ7i5RqjE9Yw89As4VpeHR1ePuTU7ei
Ape #180 G4VshHmcaVn7Y5aqiF7Zn8iZ2wmprwf3KCwf3sdpBGRL
Ape #195 3PRZ7r6t3THHwNYv2A8jM1KGjA8Jqid49GhwGRBbhnnP
Ape #198 Ao5tVE1pRV3CjJBAsU1uMZND3tgpgr2enoMEeTVAk9pt
Ape #207 5yR2tWxeib8WjQGMTQCqZBiFs9Api5kioo1oixVJRL63
export namespace OT {
export type path = Array<string | number>;
export namespace Object {
export interface Add {
p: OT.path;
oi: any;
}
export interface Remove {
p: OT.path;
+------------------+
| what are your |
| favourite foods? |
+------------------+
| |
+--------+ +-----------+
| Fruit | | Vegetable |
+--------+ +-----------+
| | |
@johnrees
johnrees / parse.ts
Created December 2, 2019 16:30
ts-morph ts-simple-ast
// https://ts-ast-viewer.com/#code/GYVwdgxgLglg9mABACwKYBt1wBRgIYC2qAXIgM5QBOMYA5gDSJ5hxRqWIC8iA5GpnB4BKUhWp1EAbwBQiRJVRQQlJAAN+WRABJJ+IgF9VAbmn6gA
import { Project, SyntaxKind } from "ts-morph";
const project = new Project({});
project.addExistingSourceFiles("./src/thing.ts");
const node = project.getSourceFileOrThrow("./src/thing.ts");
const result = node.forEachDescendant((node, traversal) => {