Skip to content

Instantly share code, notes, and snippets.

View avatars.ts
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",
View release-tweet.yml
on:
release:
types:
- published
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- uses: ethomson/send-tweet-action@v1
with:
View getSolDomainOwner.js
const {
getHashedName,
getNameAccountKey,
NameRegistryState,
} = require("@solana/spl-name-service");
const {
Connection,
clusterApiUrl,
PublicKey,
View example-request.sh
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 }
}
View apes.csv
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
View ot.ts
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;
View 0_graph.ascii
+------------------+
| what are your |
| favourite foods? |
+------------------+
| |
+--------+ +-----------+
| Fruit | | Vegetable |
+--------+ +-----------+
| | |
@johnrees
johnrees / parse.ts
Created Dec 2, 2019
ts-morph ts-simple-ast
View parse.ts
// 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) => {
@johnrees
johnrees / a11y.js
Created Nov 29, 2019
js to make cargocollective a bit more accessibility friendly
View a11y.js
try {
// add img alt tags using filename
document.addEventListener(
"DOMContentLoaded",
function() {
[...document.getElementsByTagName("img")].forEach(i => {
i.alt = i.src
.split("/")
.pop()
.split(".")
@johnrees
johnrees / duckling.sh
Created Oct 2, 2019
install duckling
View duckling.sh
adduser ducklinguser --ingroup admin
su ducklinguser
cd
echo "export PATH=$PATH:~/.local/bin" >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/facebook/duckling
cd duckling
sudo apt-get update -y
sudo apt-get install build-essential libpcre++-dev libpcre3-dev -y
stack build && stack test && stack install