Skip to content

Instantly share code, notes, and snippets.

View kim366's full-sized avatar

Kim Schmider kim366

  • Sydney
View GitHub Profile
@kim366
kim366 / swizzle.jl
Last active January 23, 2022 13:11
GLSL vector Swizzling in Julia
macro swizzle(vec, components)
function index(component)
(component == 'x' || component == 'r') && return 1
(component == 'y' || component == 'g') && return 2
(component == 'z' || component == 'b') && return 3
(component == 'w' || component == 'a') && return 4
error("swizzling components must be one of x, y, z, w")
end
accesses = [Expr(:ref, :vec, index(component)) for component in string(components)]
#!/bin/bash
cd $(dirname $0)
set -e
def apply_chunked(data, fn, dim):
"""
Some xarray operations, such as resample disregard the fact that the loaded data set is distributed via dask.
This function applies any such operation to each chunk individually.
Arguments:
data: the xarray.Dataset
fn: any unary function acting on an xarray.Dataset
dim: the dimension to split chunks across as str
"""
@kim366
kim366 / .xbindkeysrc
Created September 27, 2023 15:50
Custom Browser Back & Forward Buttons
# https://askubuntu.com/questions/455762/xbindkeys-wont-work-properly
"xset r off; xdotool keyup --window 0 XF86Calculator key --clearmodifiers --window 0 ctrl+shift+Tab; xset r on"
XF86Calculator
"xset r off; xdotool keyup --window 0 XF86HomePage key --clearmodifiers --window 0 ctrl+Tab; xset r on"
XF86HomePage
@kim366
kim366 / init.el
Created January 5, 2024 14:12
Emacs org-mode automatically fetch link title
;; Adpated from https://gist.github.com/jmn/34cd4205fa30ccf83f94cb1bc0198f3f
;; Automatically fetch link description (C-c C-l) for link at point
(defun my/url-get-title (url &optional descr)
(with-temp-buffer
(url-insert-file-contents url)
(goto-char (point-min))
(search-forward-regexp (rx "<title>" (group (*? anything)) "</title>"))
(match-string 1)))
@kim366
kim366 / match-color-temp-kelvin.yaml
Created December 29, 2025 09:41 — forked from HarvsG/match-color-temp-kelvin.yaml
HA Blueprint to match color temperature of lights to the sun. To add it to your home assistant see it on the community forum: https://community.home-assistant.io/t/automatic-circadian-lighting-match-your-lights-color-temperature-to-the-sun/472105
blueprint:
name: Match Outside Colour Temperature Kelvin
description: When a light turns on or the sun elevation changes, match the outside
colour temperature. It will apply to any bulb that supports color temperature.
It triggers; whenever a bulb turns on, on sun elevation changes and every 5 minutes.
domain: automation
input:
target_lights:
name: Lights
description: The primary lights to be controlled