Skip to content

Instantly share code, notes, and snippets.

View zer0cache's full-sized avatar

zer0cache

View GitHub Profile
@NotoriousPyro
NotoriousPyro / connection-manager.ts
Created March 15, 2024 21:31
ConnectionManager Solana class for SexBot
import {
Instruction,
SwapInstructionsResponse
} from "@jup-ag/api";
import {
AddressLookupTableAccount,
ComputeBudgetProgram,
Connection,
Keypair,
PublicKey,
@xiaopc
xiaopc / gaWorker.js
Last active November 12, 2024 14:52
Google Analytics 4 Proxy with Cloudflare Workers
// 2023.4.23 更新,修复 gtag.js 加了个回车导致失效的问题
// 2023.3.2 更新,修复上报到 region*.google-analytics.com 未被代理的问题
addEventListener('fetch', (event) => {
// 这里可以加 filter
return event.respondWith(handleRequest(event));
});
// worker 应用的路由地址,末尾不加 '/'
const DOMAIN = 'https://example.workers.dev/routerpath';
@pucbabajob
pucbabajob / rds-lambda-s3.py
Last active September 26, 2023 16:36
Query RDS from lambda and save the result as CSV, Sent the result in Email, Save the Result in S3
# Query RDS From Lambda and Send Results in Email and Save it to S3
# Blog Post: https://blog.powerupcloud.com/automate-rds-and-aurora-mysql-processes-list-in-lambda-with-kms-736b2878349
# Verson 1.1
# Bug fix1 : Mulitple email receipts
import sys
import logging
import pymysql
import os
@syafiqfaiz
syafiqfaiz / how-to-copy-aws-rds-to-local.md
Last active October 8, 2025 11:34
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active October 11, 2025 04:08
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'