Skip to content

Instantly share code, notes, and snippets.

View zer0cache's full-sized avatar

zer0cache

View GitHub Profile
@zer0cache
zer0cache / connection-manager.ts
Created March 15, 2024 23:47 — forked from NotoriousPyro/connection-manager.ts
ConnectionManager Solana class for SexBot
import {
Instruction,
SwapInstructionsResponse
} from "@jup-ag/api";
import {
AddressLookupTableAccount,
ComputeBudgetProgram,
Connection,
Keypair,
PublicKey,
@zer0cache
zer0cache / gaWorker.js
Created February 16, 2023 21:37 — forked from xiaopc/gaWorker.js
Google Analytics 4 Proxy with Cloudflare Workers
addEventListener('fetch', (event) => {
// 这里可以加 filter
return event.respondWith(handleRequest(event));
});
// worker 应用的路由地址,末尾不加 '/'
const DOMAIN = 'example.workers.dev/routerpath';
// 响应上报的接口路径,可自定义
const COLLECT_PATH = 'any-collect-dest-path';
// 原 gtag 地址
@zer0cache
zer0cache / postgres_queries_and_commands.sql
Last active October 29, 2021 07:48 — forked from rgreenjr/postgres_queries_and_commands.sql
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%'
@zer0cache
zer0cache / how-to-copy-aws-rds-to-local.md
Created September 11, 2021 06:34 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
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