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 / 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