Skip to content

Instantly share code, notes, and snippets.

View AlperRehaYAZGAN's full-sized avatar
🏠
Working from home

alperreha AlperRehaYAZGAN

🏠
Working from home
View GitHub Profile
@AlperRehaYAZGAN
AlperRehaYAZGAN / golang-like-error-helper.ts
Last active April 22, 2025 21:12
a simple golang error returner like helper function in javascript https://www.npmjs.com/package/promise-like-go
// executeAsync is golang like function that returns [result,err] pair.
export async function executeAsync<T>(fn: () => Promise<T>): Promise<[T | null, any]> {
try {
const result = await fn();
return [result, null];
} catch (error) {
return [null, error];
}
}
@AlperRehaYAZGAN
AlperRehaYAZGAN / .nextjs-tw-frontend-instructions.md
Last active February 3, 2025 15:52
a simple github copilot instructions markdown file for personal purposes. inspired from: https://x.com/illyism/status/1885453305679405149

You are an expert TypeScript/Tailwindcss/Next.js v15 (app directory) developer focused on writing clean, maintainable code. Prioritize these qualities:

  1. Minimal - Absolute minimum code needed
  2. Self-documenting - Code explains itself through:
    • Precise naming (verbs for functions, nouns for variables)
    • Single-responsibility components
    • Obvious data flow
    • Add short comments when necessary
  3. Type-Exact - Strict TypeScript types with zero any
@AlperRehaYAZGAN
AlperRehaYAZGAN / tg_forward.py
Last active January 10, 2025 00:51
a simple tg forwarder
from telethon import TelegramClient, events
import re
import os
from datetime import datetime
from colorama import init, Fore, Style
from solders.pubkey import Pubkey
import base58
# Initialize colorama for cross-platform colored output
init()
@AlperRehaYAZGAN
AlperRehaYAZGAN / solana-secretbase58-to-json.js
Created November 12, 2024 12:21
A simple phantom wallet base58 private key text to json convertor.
/*
"dependencies": {
"@solana/web3.js": "^1.95.4",
"bip39": "^3.1.0",
"bs58": "^6.0.0"
}
*/
const bs58 = require("bs58");
const { Keypair } = require("@solana/web3.js");
@AlperRehaYAZGAN
AlperRehaYAZGAN / content.js
Created November 12, 2024 12:14
A simple Twitter Gist Viewer Extension written by js. (chrome extension)
/*
// manifest.json
{
"manifest_version": 3,
"name": "GitHub Gist Displayer for Twitter",
"version": "1.0",
"description": "Displays GitHub Gist content directly on Twitter posts",
"permissions": [
"activeTab",
"https://api.github.com/*",
@AlperRehaYAZGAN
AlperRehaYAZGAN / bytebase-compose.yaml
Created November 5, 2024 20:31
Simple bytebase docker-compose file with some definitions
# docker run --rm --init \
# --name bytebase \
# --publish 8080:8080 --pull always \
# --volume ~/.bytebase/data:/var/opt/bytebase \
# bytebase/bytebase:2.20.0
version: '3.8'
services:
bytebase:
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--flannel-backend=none --disable-network-policy --cluster-cidr=10.87.0.0/16" sh -
export K3S_URL=https://10.19.180.103:6443
export K3S_TOKEN=
curl -sfL https://get.k3s.io | K3S_URL=https://serverip:6443 =mytoken sh -
@AlperRehaYAZGAN
AlperRehaYAZGAN / supabase-compose.yml
Last active September 3, 2024 13:49
Supabase minimal docker-compose.yml
# Usage
# Start: docker compose up
# With helpers: docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up
# Stop: docker compose down
# Destroy: docker compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans
name: supabase
version: "3.8"
services:
# SHORT: one line below:
# CONTENT=$(cat plantuml.dot | python -c "import sys; import base64; import zlib; print(base64.urlsafe_b64encode(zlib.compress(sys.stdin.read().encode('utf-8'), 9)).decode('ascii'))") curl -X POST https://kroki.io/excalidraw/svg --data-binary '@app.dot' -o app.svg
# create file
cat <<EOF > plantuml.dot
skinparam ranksep 20
skinparam dpi 125
skinparam packageTitleAlignment left
rectangle "Main" {