Skip to content

Instantly share code, notes, and snippets.

View NinjaBunny9000's full-sized avatar

Krissy Heishman NinjaBunny9000

View GitHub Profile
@NinjaBunny9000
NinjaBunny9000 / HUErgbToXy.js
Last active May 14, 2023 13:24
[js] RGB to XY Colorspace (Hue ColorGamut)
// This is based on original code from http://stackoverflow.com/a/22649803
// with special credit to error454's Python adaptation: https://gist.github.com/error454/6b94c46d1f7512ffe5ee
function EnhanceColor(normalized) {
if (normalized > 0.04045) {
return Math.pow( (normalized + 0.055) / (1.0 + 0.055), 2.4);
}
else { return normalized / 12.92; }
}
@danallison
danallison / with_sql_session.py
Last active April 23, 2024 07:32
Connect to Postgresql locally or through SSH tunnel
from sshtunnel import SSHTunnelForwarder
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from functools import wraps
# secrets.py contains credentials, etc.
import secrets
def get_engine_for_port(port):
return create_engine('postgresql://{user}:{password}@{host}:{port}/{db}'.format(
@fperez
fperez / ProgrammaticNotebook.ipynb
Last active May 2, 2024 19:14
Creating an IPython Notebook programatically
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.