Skip to content

Instantly share code, notes, and snippets.

@hsab
hsab / bokeh_notebook_image_figure.py
Created March 14, 2021 16:56 — forked from victor-shepardson/bokeh_notebook_image_figure.py
dynamic RGB image figure in bokeh+jupyter for monitoring GAN training, etc. import or paste into cell.
try:
from bokeh.io import push_notebook, output_notebook, show
from bokeh.plotting import figure
output_notebook()
def dynamic_image_figure(w,h):
"""create an RGB image figure in current cell and return an update function for it"""
def im2bokeh(img):
img = (img*255).astype(np.uint8)
img = np.dstack([img, np.ones(img.shape[:2], np.uint8) * 255])
img = np.squeeze(img.view(np.uint32))
@hsab
hsab / run-program.ahk
Created September 2, 2018 21:59
Run a program with a keyboard shortcut with AutoHotKey
; This is a simple and pretty generic example of an AutoHotkey script to run a
; program when you press a keyboard shortcut. Add as many of these as you want
; to a .ahk file, and set that to be run at startup.
; See the Hotkeys reference [1] for details of the modifiers and keys available.
; [1]: http://www.autohotkey.com/docs/Hotkeys.htm
; Win+Alt+G - Open Gmail in Chrome
@hsab
hsab / GLSL-Noise.md
Created October 26, 2017 03:53 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}