Skip to content

Instantly share code, notes, and snippets.


Ole Jørgen Brønner olejorgenb

View GitHub Profile
View constrainedWindow.js
#!/usr/bin/env gjs
Create a window with given size constraints
Run it with:
const Gio =;
olejorgenb /
Created Sep 1, 2019
Lookup elevation in Norway based on geonorge's wms service
Author: Ole Jørgen Brønner,
Lookup elevation in Norway (NB: might need to change dataset for northern Norway)
- owslib
- rasterio
View clutter-shader.js
function applyMotionBlur(actor, n, dir, wFn=function() { return 1; }) {
function blurShaderSource() {
function SAMPLE(offx, offy, w) {
return `pixel += ${w} * texture2D (tex, cogl_tex_coord_in[0].st + vec2(width_inv, height_inv) * vec2 (${offx}, ${offy}));`
function motionBlur(n, sign=1) {
let vs = []
let weights = []
let sum = 0
olejorgenb / places-exploration.sql
Created Feb 17, 2019
Firefox places.sqlite exploration
View places-exploration.sql
--- Firefox places.sqlite exploration
-- (probably somewhat outdated)
-- [select text -> right click -> search] does not set from_visit :(
--- Magic numbers
olejorgenb / copy-permalink.lua
Last active Jul 31, 2022
mpv user script: copy a command that will resume video at current position
View copy-permalink.lua
olejorgenb / dconf-editor-with-extensions-schemas
Created Dec 10, 2017
View dconf-editor-with-extensions-schemas
#!/usr/bin/env zsh
## man dconf-editor:
# > dconf-editor reads gsettings schemas from $XDG_DATA_DIRS/glib-2.0/schemas
# > to obtain descriptions, default values and allowed values for keys.
# It only reads compiled schemas and only look for a single file -
# 'gschemas.compiled' per XDG_DATA_DIR though.. (??)
olejorgenb / _copyq
Last active Jun 3, 2020
zsh completions for copyq
View _copyq
#compdef copyq
typeset -A cmds
show 'show main window and optionally open tab with given name'
hide 'hide main window'
toggle 'show or hide main window'
menu 'open context menu'
olejorgenb / autosuggest-complete.zsh
Created Sep 3, 2017
Offer zsh-autosuggestion as a completion candidate
View autosuggest-complete.zsh
# Make the autosuggestion a completion value
function _autosuggest_complete() {
local -a candidates
# IMPROVEMENT: If we can be sure that autosuggest has already run we can
# just grab the suggestion variable, avoiding the double call
ZSH_AUTOSUGGEST_USE_ASYNC=0 # need the result immediately
_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY "$BUFFER"
olejorgenb /
Created Jul 16, 2017 — forked from andsens/
Merges a repo into a subdirectory of another repo (useful when making a submodule part of a parent repo)
#!/bin/bash -e
function merge_repo_to_subdir {
local url=$1
local commit=$2
local module_path=$3
if [[ -z $url || -z $commit || -z $module_path ]]; then
echo "Usage: URL BRANCH PATH" >&2
exit 1
olejorgenb / nix-package-search
Last active Jul 4, 2022
View nix-package-search