Skip to content

Instantly share code, notes, and snippets.

@pixelchai
pixelchai / python.gitignore
Last active May 1, 2024 13:37
My simple Python .gitignore file
__pycache__/
*.lock
**/.nfs*
.idea/
/venv/
**/.fuse_hidden*
.ipynb_checkpoints/
@pixelchai
pixelchai / human_number.py
Last active May 8, 2021 02:22
Return human-readable version of number with suffix. E.g: 30.4k (base 10)
def human_number(num):
"""
return human-readable version of number. E.g: 30.4k
"""
# https://gist.github.com/pixelzery/eace0b100a381e7cf724612b7309a9d2
if num == 0:
return "0"
elif num < 0:
return "-" + human_number(-num)
@akaleeroy
akaleeroy / youtube-badtitles.js
Last active September 25, 2020 01:33
Parsing song titles on YouTube
/* eslint-disable */
// YouTube Music Uploader Hall of Shame
// Trying to grok the range of malformed input in song title strings
[
'BPC335 - Maxime Iko "Concilium"', // wrong order (catalog number before everything else), extra info (catalog number), bad separator `"`, bad extra separator `-`
'"Pollution" by Tom Lehrer', // wrong order (`Artist - Title` reversed), quotes, bad separator `by`
'DIS IZ WHY I\'M HOT (zef remix) - Die Antwoord', // `Artist - Title` reversed, bad case
'Man with no name - Teleport (Original mix). HQ', // bad case, noisy `(Original mix)`, extra info `HQ`, bad extra separator `.`
'Varg — Under Beige Nylon', // uneven spaces, bad separator `—`
'varg - under beige nylon - 46bpm', // bad case, bad extra separator `-`, extra info `46bpm`