Skip to content

Instantly share code, notes, and snippets.

@OrionReed
OrionReed / dom3d.js
Last active December 21, 2024 18:11
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@RazhanHameed
RazhanHameed / resolve_ae.py
Last active September 9, 2023 07:24
A Python function to correct the misspelling of the AE character (ە) in Kurdish text.
import re
def resolve_ae(text):
"""
This function takes a text input in Central Kurdish (Sorani) script and performs a series of character replacements
to standardize variations in the script. Specifically, it addresses cases where the character 'ە' (Arabic letter
AE) may be used in different contexts.
"""
# First replace all occurrences of 'ه' with 'ە'
text = re.sub("ه", "ە", text)
@Justasic
Justasic / tlo.hexpat
Last active May 1, 2023 16:00
ImHex (https://imhex.werwolv.net/) Telegram TLO object decoding (TLO schema v2 should match what Telegram uses)
#include <std/mem.pat>
#include <std/io.pat>
#include <std/sys.pat>
enum ConstructorIDType : u32 {
CID_TLSTYPE = 0x12eb4386,
CID_NATCONST = 0x8ce940b1,
CID_NATVAR = 0x4e8a14f0,
CID_EXPRNAT = 0xdcb49bd8,
CID_EXPRTYPE = 0xecc9da78,
@DavideGalilei
DavideGalilei / README.md
Created March 9, 2023 12:44
Physics simulation test in C + SDL2
@Elschnagoo
Elschnagoo / Semaphor.ts
Created July 28, 2022 02:37
Simple Typescript Semaphor / Mutex
import crypto from 'crypto';
export type SemElement = [string, (value: any | PromiseLike<any>) => void];
export class Semaphor {
private curQueue: Map<string, SemElement>;
private readonly max: number;
private callbackQueue: SemElement[];
@alemidev
alemidev / commit-msg.sh
Last active July 16, 2023 18:17
A git hook that forces you to respect Commit Convention
#!/bin/bash
#
# Commit Convention Hook | alemi <[email protected]> May 2022
#
# A simple git hook to enforce (sort of) Commit Convention.
# www.conventionalcommits.org
#
# This script uses bash builtin regex matching, so it's not sh compatible.
#
# Commit message will be stripped of comments (lines starting with #) and matched
@allekok
allekok / blockchain.py
Created May 19, 2022 18:19
Blockchain
import hashlib
blockchain = []
difficulty = 3
mine_pattern = '0' * difficulty
def add_block(data):
block = make_block(data)
block['prev'] = '' if blockchain == [] else blockchain[-1]['hash']
mine_block(block)
@MidSpike
MidSpike / readme.md
Last active July 19, 2024 20:45
CVE-2022-23812 | RIAEvangelist/node-ipc is malware / protest-ware
@painor
painor / call.ts
Created February 9, 2022 21:41
Make a call in telegram using GramJS
import { StoreSession} from "telegram/sessions";
import { TelegramClient } from "telegram/client/TelegramClient";
import { Api } from "./tl";
import { generateRandomBigInt, readBigIntFromBuffer, readBufferFromBigInt, sha256 } from "telegram/Helpers";
import bigInt from "big-integer";
const apiId = ;
@hyrious
hyrious / require-to-import.mjs
Last active March 23, 2024 02:33
plugin to get rid of '__require' in esbuild
var RequireToImportPlugin = {
name: 'require-to-import',
setup({ onResolve, onLoad, esbuild }) {
function matchBrace(text, from) {
if (!(text[from] === '(')) return -1;
let i, k = 1;
for (i = from + 1; i < text.length && k > 0; ++i) {
if (text[i] === '(') k++;
if (text[i] === ')') k--;
}