Skip to content

Instantly share code, notes, and snippets.

@yous
yous / color.py
Created October 2, 2018 11:29
256 colors for Open Color according to CIEDE2000
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
def hex_to_rgb(h):
return sRGBColor(h / 0x10000, (h / 0x100) % 0x100, h % 0x100,
is_upscaled=True)
@blairanderson
blairanderson / conv.sh
Last active December 20, 2021 17:57
Optimize Videos for Web - Compress MP4 and remove Audio with FFMPEG. encodes as 264 with CRF 30, scales down to 1920x1080, strips audio
#! /bin/bash
# The Purpose of this Script is to batch convert and compress any video file to mp4 format
#
# WARNING: LOSSY COMPRESSION !!!
# Variable used:
# sourcedir is the directory where to be converted videos are. Converted video will be saved in the same folder
# usage:
@husa
husa / xml2react.js
Last active January 18, 2024 10:34
XML to React Component
const xml = `
<XMLText class="yeah-attributes">
regular text
<XMLBold>
bold text
</XMLBold>
another text
</XMLText>
`;
@skeggse
skeggse / crypto-pbkdf2-example.js
Last active May 21, 2024 09:21
Example of using crypto.pbkdf2 to hash and verify passwords asynchronously, while storing the hash and salt in a single combined buffer along with the original hash settings
var crypto = require('crypto');
// larger numbers mean better security, less
var config = {
// size of the generated hash
hashBytes: 32,
// larger salt means hashed passwords are more resistant to rainbow table, but
// you get diminishing returns pretty fast
saltBytes: 16,
// more iterations means an attacker has to take longer to brute force an