Skip to content

Instantly share code, notes, and snippets.

View bun9000's full-sized avatar

Krissy Heishman bun9000

View GitHub Profile
@bun9000
bun9000 / HUErgbToXy.js
Last active August 12, 2024 02:57
[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 August 29, 2024 10:08
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 March 20, 2025 03:57
Creating an IPython Notebook programatically
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.