Skip to content

Instantly share code, notes, and snippets.

View virtualfunction's full-sized avatar

Jason Earl virtualfunction

View GitHub Profile
@nat-418
nat-418 / hyper-key.desktop
Last active August 11, 2025 09:22
How to enable the Hyper key on Linux
[Desktop Entry]
Name[en_US]=hyper-key
Comment[en_US]=Set CapsLock to Control and Escape to Hyper
Exec=/usr/local/bin/hyper-key.sh
Icon=application-default-icon
X-GNOME-Autostart-enabled=true
Type=Application
@lbatteau
lbatteau / sse-fastapi-redis.py
Last active March 26, 2026 15:21
Server-Sent Events in FastAPI with async Redis Pub/Sub
from aioredis import Channel, Redis
from fastapi import FastAPI
from fastapi.params import Depends
from fastapi_plugins import depends_redis, redis_plugin
from sse_starlette.sse import EventSourceResponse
from starlette.responses import HTMLResponse
html = """
<!DOCTYPE html>
<html>
@wboykinm
wboykinm / histogram.sql
Created October 12, 2015 13:07 — forked from wolever/histogram.sql
Functions to create and draw histograms with PostgreSQL.
-- Functions to create and draw histograms with PostgreSQL.
-- psql> select * from show_histogram((select histogram(length(email), 0, 32, 6) FROM auth_user limit 100));
-- bucket | range | count | bar | cumbar | cumsum | cumpct
-- --------+-------------------------------------+-------+--------------------------------+--------------------------------+--------+------------------------
-- 0 | [0,5.33333333333333) | 1 | | | 1 | 0.00273224043715846995
-- 1 | [5.33333333333333,10.6666666666667) | 5 | = | | 6 | 0.01639344262295081967
-- 2 | [10.6666666666667,16) | 149 | ============================== | ============= | 155 | 0.42349726775956284153
-- 3 | [16,21.3333333333333) | 145 | =========