Skip to content

Instantly share code, notes, and snippets.

View staciax's full-sized avatar
🖤
I may be slow to respond.

STACIA staciax

🖤
I may be slow to respond.
  • Bangkok, Thailand
  • 07:56 (UTC +07:00)
  • X @stacia__x
View GitHub Profile
@idleberg
idleberg / vscode-macos-context-menu.md
Last active December 10, 2025 20:19
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@Soheab
Soheab / wait_for_modal.md
Last active November 18, 2024 20:27
See how to wait for user input using a modal!

Wait for with a Modal

See here an overcomplicated way to wait for input from a user using a modal. Every step is explained using comments.

This is meant to replace Client.wait_for("message") for application commands.

Features

  • Easy way to construct a Modal with one text input field.
  • Easily pass a check from the constructor

Files

@jcrist
jcrist / kv.py
Created September 19, 2022 01:48
An example TCP Key-Value store written using msgspec and asyncio
"""An example key-value store server and client implementation using msgspec
and asyncio.
Requests are serialized using the MessagePack protocol, as implemented by
msgspec. Additionally, all messages are length-prefix framed using a 32 bit
big-endian integer.
Note that this encoding isn't tied to either asyncio or msgspec - this could
just as easily be implemented using sockets and a different serialization
protocol. Length-prefix framing is useful in that respect - it separates the IO
@jbwhit
jbwhit / example-ruff-formatting.ipynb
Last active October 23, 2025 03:44
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active December 15, 2025 23:27
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This does not works in browser for quests which require you to play a game! Use the desktop app to complete those.

How to use this script:

  1. Accept a quest under Discover -> Quests
  2. Press Ctrl+Shift+I to open DevTools
  3. Go to the Console tab
  4. Paste the following code and hit enter:
@nrbnlulu
nrbnlulu / msgspec_vs_pydanticv2.py
Created June 18, 2024 08:43
Msgspec vs Pydantic v2
from datetime import datetime
import json
import re
import timeit
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Annotated, Any, Callable, Iterator, TypedDict
from pydantic.annotated_handlers import GetJsonSchemaHandler
@hansheng0512
hansheng0512 / crypto.ts
Created September 20, 2024 03:14
Encrypt and Decrypt string using Typescript
import * as crypto from 'crypto';
// Secret key generation (should be stored securely and not hardcoded)
const secretKey = crypto.createHash('sha256').update(String('your-secret-key')).digest('base64').substr(0, 32);
function encrypt(text: string): string {
const iv = crypto.randomBytes(16); // Initialization vector
const cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(secretKey), iv);
const encrypted = Buffer.concat([cipher.update(text, 'utf8'), cipher.final()]);
// Return the IV and encrypted data as a combined string