Skip to content

Instantly share code, notes, and snippets.

@LesterLian
LesterLian / github_markdown_api.sh
Created January 10, 2024 16:49
Github Markdown API requires a JSON payload. Line breaks require special parsing.
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/markdown \
-d '{"text":'"$(cat README.md | jq -s -R '.')"'}'
@LesterLian
LesterLian / uid2uuid.py
Created May 19, 2023 16:05
UUID5 with salt
from uuid import UUID, uuid5
from hashlib import md5
salt = 'SALT'
uid = input('Enter uid: ')
salt_hash = md5(salt.encode('utf-8')).digest()
namespace = UUID(bytes=salt_hash)
print(uuid5(namespace, uid))
@LesterLian
LesterLian / open_ipynb_win.bat
Created August 1, 2020 22:41
Run jupyter lab within Anaconda when open .ipynb file.
@echo off
@REM To associate extension with file type
@REM assoc [<.ext>[=[<filetype>]]]
@REM To set open command for file type
@REM ftype [<filetype>[=[<opencommandstring>]]]
@REM To set up Anaconda environment. Replace PATH at the end.
@REM cmd.exe "/K" PATH:to\Anaconda3\Scripts\activate.bat PATH:to\env
@REM Get admin
@REM Check for permissions