Skip to content

Instantly share code, notes, and snippets.

@99darwin
99darwin / airdrop.ts
Created May 29, 2025 19:34
Delegate compressed airdrop to farcaster
import { approve, getOrCreateAssociatedTokenAccount } from '@solana/spl-token';
import { PublicKey, Keypair, Connection } from '@solana/web3.js';
import { createTokenPool } from '@lightprotocol/compressed-token';
import bs58 from 'bs58';
import { createRpc } from '@lightprotocol/stateless.js';
// Constants
const SOLANA_RPC_URL = 'https://staked.helius-rpc.com?api-key=<YOUR_API_KEY>'; // Replace with your preferred rpc provider
const TOKEN_MINT_ADDRESS = new PublicKey(
'YOUR_TOKEN_MINT_ADDRESS'
@99darwin
99darwin / config.ts
Created November 26, 2024 15:04
Initialize Raydium SDK with configs
import { Raydium, TxVersion, parseTokenAccountResp } from '@raydium-io/raydium-sdk-v2'
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js'
import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'
const RPC_ENDPOINT = process.env.RPC_ENDPOINT
/**
* Get an RPC endpoint from Helius or similar
* Alternatively use a free endpoint (less reliable)
*/
export const connection = new Connection(RPC_ENDPOINT);
@99darwin
99darwin / sketch.js
Created January 8, 2024 00:42
TorusTest Highlight Generative Art Testing
let xRotation = 0;
let yRotation = 0;
let xRotationSpeed, yRotationSpeed;
let torusX, torusY, randomDetailX, randomDetailY;
let bgColor;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
// Set random background color once
@99darwin
99darwin / build.gradle
Last active June 4, 2020 19:39
tipsi-stripe_error_logs
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
@99darwin
99darwin / divid-api.js
Last active June 26, 2019 15:38
Divid api example for node-rpc-tutorial
const RpcClient = require('divid-rpc')
const config = require('./config')
module.exports = app => {
const rpc = new RpcClient(config.config)
app.get('/blockcount', (req, res) => {
rpc.getBlockCount((err, response) => {
if (err) {
console.error(err)
@99darwin
99darwin / index.js
Last active June 26, 2019 15:26
Simple server for node-rpc-tutorial
const express = require('express')
const bodyParser = require('body-parser')
const path = require('path')
const app = express()
const port = process.env.PORT || 1337
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
@99darwin
99darwin / cognito-to-ddb-test.json
Created June 12, 2019 01:12
Test request for Cognito to DynamoDB Lambda Function
{
"userName": "johnnysmith",
"request": {
"userAttributes": {
"email": "exampleuser@example.com",
"email_verified": true,
"name": "Johnny Smith",
"sub": "abcdevfefe-1232132-cofeve"
}
},
@99darwin
99darwin / cognito-to-ddb.js
Last active June 12, 2019 01:11
Add new Amazon Cognito users to DynamoDB with Lambda
var aws = require('aws-sdk');
var ddb = new aws.DynamoDB({apiVersion: '2012-10-08'});
exports.handler = async (event, context) => {
console.log(event);
let date = new Date();
const tableName = process.env.TABLE_NAME;
const region = process.env.REGION;
@99darwin
99darwin / increaseWPFileSize.md
Created April 22, 2019 15:49
Increase max upload size for WordPress site manually

Motivation

You may want to increase the max upload size on your WordPress installation in order to upload a custom theme or larger media files.

Note: This will not work on shared hosting plans. This workaround is only for self-hosted WordPress installations.

How to

From your server, access the php.ini file under your PHP installation directory.

sudo nano /etc/php/<php_version>/apache2/php.ini
@99darwin
99darwin / WordPressAZ.md
Last active April 19, 2019 15:30
Setting up a WordPress site on Digital Ocean from A-Z

Prerequisites

This guide assumes that you already have some of the basics handled.

  1. A Digital Ocean account
  2. A Droplet running Ubuntu 18.04 deployed (but not set up)
  3. A domain (optional)
  4. Basic understanding of SSH
  5. Basic understanding of nano

NOTE: all items marked in bold are boilerplate and should be replaced with your own values.