Skip to content

Instantly share code, notes, and snippets.

View itoonx's full-sized avatar
👻
Deep

Makkhawan Voraboot itoonx

👻
Deep
View GitHub Profile
DO NOT GIVE ME HIGH LEVEL STUFF, IF I ASK FOR FIX OR EXPLANATION, I WANT ACTUAL CODE OR EXPLANATION!!! I DON'T WANT "Here's how you can blablabla"
- Be casual unless otherwise specified
- Be terse
- Suggest solutions that I didn’t think about—anticipate my needs
- Treat me as an expert
- Be accurate and thorough
- Give the answer immediately. Provide detailed explanations and restate my query in your own words if necessary after giving the answer
- Value good arguments over authorities, the source is irrelevant
- Consider new technologies and contrarian ideas, not just the conventional wisdom
@itoonx
itoonx / libpq.md
Created March 11, 2025 00:56 — forked from netsensei/libpq.md
pqsl, pg_dump and pg_restore via hombrew

Installing pqsl, pg_dump and pg_restore via hombrew

These instructions allow you to intall psql, pg_dump & pg_restore without a full installation of postgresql.

First, install libpq via homebrew

brew doctor
brew update
brew install libpq
@itoonx
itoonx / end-session.md
Created February 17, 2025 06:57 — forked from zbeyens/end-session.md
Store these in your project .ai folder

End Session Instructions

  1. Create a new file: .ai/status/YYYY-MM-DD.md

  2. Structure the update with sections:

    • Development Steps
    • Key Decisions
    • Next Steps
import requests
from tronpy import Tron
import trontxsize
from tronpy.keys import PrivateKey
def get_bandwidth_price():
url = "https://api.trongrid.io/wallet/getchainparameters"
response = requests.get(url)
data = response.json()
CREATE OR REPLACE FUNCTION "public"."create_profile_on_signup"() RETURNS "trigger"
LANGUAGE "plpgsql" SECURITY DEFINER
AS $$begin
INSERT INTO public.profile (id)
VALUES (
NEW.id
);
RETURN NEW;
end;$$;
const {
id,
createClient,
CreateAccountError,
CreateTransferError,
TransferFlags,
} = require("tigerbeetle-node");
console.log("Import ok!");
@itoonx
itoonx / .aider.config.yml
Created October 6, 2024 00:04
Aider configuration file
##########################################################
# Sample .aider.conf.yml
# This file lists *all* the valid configuration entries.
# Place in your home dir, or at the root of your git repo.
##########################################################
# Note: You can only put OpenAI and Anthropic API keys in the yaml
# config file. Keys for all APIs can be stored in a .env file
# https://aider.chat/docs/config/dotenv.html
@itoonx
itoonx / jimp-example.js
Created April 7, 2023 20:37 — forked from ASteinheiser/jimp-example.js
An example of how to use Jimp to read a base64 image string, resize, removeExif data, then return as an image buffer.
let imageBuffer = Buffer.from(body.profilePicture.split(',')[1], 'base64');
console.log(imageBuffer);
Jimp.read(imageBuffer, function(err, image) {
if (err) {
context.done(err,
prepareErrorResponse(response, 'Unable to remove EXIF data from profile picture'));
}
console.log('before transform: ', image);
image = image.resize(400, 400).exifRotate((err, exifRotatedData) => {
@itoonx
itoonx / Shamir_Secret_Sharing_Scheme.py
Last active December 15, 2022 09:33
MPC from ChatGPT
import random
# Returns a random prime number with n bits
def generate_prime(n):
while True:
p = random.getrandbits(n)
if is_prime(p):
return p
# Returns the result of evaluating a polynomial with coefficients
@itoonx
itoonx / gist:9332fd7ae7acba235c178005b6c6eaf2
Created October 22, 2021 08:10 — forked from yonjah/gist:5082855
Blocking DDOS bots with JavaScript for fun and profit! Or how easy it is to break the current protection methods and how to make it better.
TL;DR - jump to the challenge at the end
====ON BLOCKING EVIL BOTS=====
On a resent job interview I had for "Incapsula" a few days ago I was put to the challenge to break
their bot protection mechanism. Apparently node.js is not that common among bot writes and most bots
are not able to run javascript.
The challenge had two parts -
1. find what the code does.
2. implement a bot that will break the code without using js.
3. think how to make this code unbreakable