Skip to content

Instantly share code, notes, and snippets.

View olejorgenb's full-sized avatar

Ole Jørgen Brønner olejorgenb

View GitHub Profile
@olejorgenb
olejorgenb / dconf-editor-with-extensions-schemas
Created December 10, 2017 17:17
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.. (??)
#
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
olejorgenb / norway_ele.py
Created September 1, 2019 16:32
Lookup elevation in Norway based on geonorge's wms service
"""
Author: Ole Jørgen Brønner, olejorgen@yahoo.no
Lookup elevation in Norway (NB: might need to change dataset for northern Norway)
Dependencies:
- owslib
- rasterio
"""
#!/usr/bin/env gjs
/*
Create a window with given size constraints
Run it with:
gjs $FILENAME
*/
const Gio = imports.gi.Gio;
@olejorgenb
olejorgenb / _copyq
Last active June 3, 2020 18:07
zsh completions for copyq
#compdef copyq
#autoload
typeset -A cmds
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
olejorgenb / nix-package-search
Last active July 4, 2022 15:22
nix-package-search
@olejorgenb
olejorgenb / copy-permalink.lua
Last active July 2, 2023 02:07
mpv user script: copy a command that will resume video at current position
@olejorgenb
olejorgenb / main.js
Last active October 27, 2023 10:35
Search SciHub for current page
// bookmarklet_title: SciHub
function findInSciHub() {
const sciHubUrl = `https://sci-hub.se/${location.toString()}`
window.open(sciHubUrl, "_blank")
}
findInSciHub()
@olejorgenb
olejorgenb / toggle-calendars-visibility.js
Last active November 16, 2023 12:19
Toggle meeting room calendar visibility in Google Calendar
// bookmarklet_title: Toggle meeting rooms
// bookmarklet_about: Toogle meeting room calendar visibility (Google Calendar)
function findCalendarCheckboxesOf(labelRegex) {
const calendarDiv = document.querySelector("[aria-label='Other calendars']")
let matches = []
for (const li of calendarDiv.querySelectorAll("li")) {
if (li.innerText.match(labelRegex)) {
matches.push(li.querySelector("input[type=checkbox]"))
}
@olejorgenb
olejorgenb / unshort.js
Last active December 23, 2023 11:54
UnShort: Open a YouTube short video as a regular video (enabling seeking etc.)
//bookmarklet_title: UnShort
function unshort() {
const videoId = location.pathname.split("/")[2]
location.replace(`/watch?v=${videoId}`)
}
unshort()