Skip to content

Instantly share code, notes, and snippets.

View nielsbom's full-sized avatar
🌳
codegrower.net

Niels Bom nielsbom

🌳
codegrower.net
View GitHub Profile
@nielsbom
nielsbom / generate_dbeaver_function_name_include_filter.sql
Created July 4, 2024 09:32
Generate string of function names installed by PostgreSQL extensions, for filtering *in* in DBeaver UI
with function_names (name) as (
SELECT
p.proname AS function_name
FROM
pg_proc p
LEFT JOIN
pg_depend d ON d.objid = p.oid
AND
d.deptype = 'e'
WHERE
@nielsbom
nielsbom / generate_dbeaver_function_name_exclude_filter.sql
Last active July 4, 2024 09:32
Generate string of function names installed by PostgreSQL extensions, for filtering *out* in DBeaver UI
-- Filters function names from extensions: postgis, btree_gist, fuzzystrmatch
with function_names (name) as (SELECT
p.proname as function_name
FROM
pg_catalog.pg_extension AS e
INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid)
INNER JOIN pg_catalog.pg_proc AS p ON (p.oid = d.objid)
INNER JOIN pg_catalog.pg_namespace AS ne ON (ne.oid = e.extnamespace)
INNER JOIN pg_catalog.pg_namespace AS np ON (np.oid = p.pronamespace)
WHERE
@nielsbom
nielsbom / split-to-scenes.sh
Last active January 15, 2024 01:50 — forked from achesco/split-to-scenes.sh
Detect and split video to scenes with ffmpeg
#!/bin/bash
# set -Eeuo pipefail
# Splits video to separate scenes files
# Source: https://gist.github.com/achesco/4dc2ebf13378a0a61fc26c7fe01f539e
# Inspired by https://stackoverflow.com/a/38205105
# The "-c:v h264_videotoolbox \" argument makes it work faster on Apple Silicon
# computers.
# ❗The bitrate argument is overriden in this version, we look at the original bitrate.
@nielsbom
nielsbom / gist:7faec8e85975dd533631706f8e3739ba
Created January 23, 2020 20:59
div with extwaiimpotscp
I pinpointed the source down to this Firefox extension: https://addons.mozilla.org/en-US/firefox/addon/dark-mode-zen/
@nielsbom
nielsbom / faux_apis.js
Created October 15, 2019 12:26
Example of how async JavaScript works with promises
const getRandomTimeOutInMs = () => Math.floor(Math.random() * 5000);
const apis = ["Facebook", "Twitter", "Instagram"];
const start = () => {
apis.forEach(api => {
let currentApi = new Promise(function(resolve, reject) {
let timeout = getRandomTimeOutInMs();
setTimeout(() => {
resolve(`The ${api} API took ${timeout} ms to respond.`);
@nielsbom
nielsbom / toggle_greyscale.osa
Created January 9, 2019 19:17
AppleScript to toggle macOS accessiblity for greyscale
# Tested on macOS Mojave.
# Depending on your language settings you may need to change "greyscale" to "grayscale".
tell application "System Preferences"
activate
reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events" to tell process "System Preferences"
repeat until exists of checkbox "Use greyscale" of group 1 of window "Accessibility"
@nielsbom
nielsbom / reasonstart.sh
Last active November 14, 2018 13:17
Shell script to init a Reason/ReasonML project, autocompile and autorun on change
# Dependencies:
# - Bucklescript: https://bucklescript.github.io/en/
# - entr for watching file changes: http://entrproject.org/
# Source this file in your bashrc (or other shell) to have the command available
# Set your $EDITOR environment variable to the editor of your choice.
# To use: $ reasonstart my-new-project
# This will create and start the new project on the given location.
function reasonstart () {
bsb -init $1 -theme basic-reason &&
cd $1 &&
@nielsbom
nielsbom / slate.js
Created July 6, 2018 10:26
My Slate (window manager) configuration for quickly toggling browser width, handy for responsive web design workflows
// Slate is here: https://github.com/jigish/slate/
// Widths for frontend development
var pushToScreenWidth = slate.operation("move", {
"x": "screenOriginX",
"y": "screenOriginY",
"width": "screenSizeX",
"height": "screenSizeY"
});
// dup duplicates the operation and changes the given parameters