Skip to content

Instantly share code, notes, and snippets.

@miclf
miclf / macos_keyboard_shortcuts_exporter_importer.php
Last active June 2, 2024 20:58
A small tool to automatically export and import custom macOS keyboard shortcuts.
#!/usr/bin/env php
<?php
// Determine which command has been called.
$cmd = (!empty($argv[1])) ? strtolower($argv[1]) : null;
// If an invalid number of arguments has been passed (or if no argument
// was given at all), display help information.
if ($argc < 2 || $argc > 3 || !in_array($cmd, ['save', 'load'])) {
@brianmacarthur
brianmacarthur / flash-app.js
Last active June 4, 2024 13:55
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@hubgit
hubgit / youtube-gif.sh
Last active September 12, 2023 23:28
Convert a section of a YouTube video to an animated GIF
#!/bin/bash
# brew install x265
# brew install ffmpeg
# brew install youtube-dl
# brew install imagemagick
ID='U65_uY5N2WM' # YouTube video ID, i.e. https://www.youtube.com/watch?v={ID}
# fetch the video file with youtube-dl