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 / bookmarklet.js
Last active October 26, 2024 07:36
gitlab-toggle-comments-only
// bookmarklet_title: Toggle comments only
// bookmarklet_about: Toggle between comments only and all activity on GitLab issues/MRs
// Source: https://gist.github.com/olejorgenb/5ee29179838a9c663a4d96b1118f283f
// LIB
// SCRIPT
function main() {
function commentOnly() {
@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()
@olejorgenb
olejorgenb / highlight-hn-author.js
Last active April 7, 2024 14:32
Highlight HN author
// bookmarklet_title: Highlight HN author
// https://chat.openai.com/c/496f4ddc-0151-40aa-af92-36897587d7ea
// Because I'm lazy
// Function to change the mouse cursor to something distinctive
function setDistinctiveCursor() {
document.body.style.cursor = 'crosshair';
}
@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 / compare-with-git-version.sh
Last active February 20, 2024 19:34
Compares the published firefox port of Tab Modifier with the github source code
#!/bin/bash
# set -x
# The URLs for the extension and the Git repo
EXTENSION_URL="https://addons.mozilla.org/firefox/downloads/file/4099496/tab_modifier-0.21.0.xpi"
GIT_REPO_URL="https://github.com/furybee/chrome-tab-modifier.git"
# The names of the extension and Git repo directories
EXTENSION_DIR="tab_modifier_extension"
#!/usr/bin/env gjs
/*
Create a window with given size constraints
Run it with:
gjs $FILENAME
*/
const Gio = imports.gi.Gio;
@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, [email protected]
Lookup elevation in Norway (NB: might need to change dataset for northern Norway)
Dependencies:
- owslib
- rasterio
"""
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 / places-exploration.sql
Last active April 7, 2024 00:35
Firefox places.sqlite exploration (browser history)
--- Firefox places.sqlite exploration
-- https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Database
-- https://wiki.mozilla.org/images/d/d5/Places.sqlite.schema3.pdf
-- http://forensicswiki.org/wiki/Mozilla_Firefox_3_History_File_Format (probably somewhat outdated)
-- [select text -> right click -> search] does not set from_visit :(
-- Gotchas :angry-face: https://superuser.com/a/1405880/153095 (Explains why your history is incomplete)