Skip to content

Instantly share code, notes, and snippets.

@ramonfritsch
ramonfritsch / expressjs-rewrite.js
Created November 9, 2016 17:06
URL rewrite on ExpressJS 4.0
....
//This is how you'd do on ExpressJS 3.0
app.get('/my/route1/', function (req, res, next) {
req.url = '/other/route2/';
next('route');
});
app.get('/other/route2/', function (req, res, next) {
res.send('I am other route 2');
@leshill
leshill / git-prunelocal
Last active June 21, 2024 14:50
Prune local tracking branches that have been removed upstream. Place file in your path (perhaps `~/bin` or `~/scripts`).
#!/bin/bash
#
# Prune local tracking branches that have been removed upstream.
# Your remote tracking branches can be removed automatically by setting `fetch.prune` to true or running `git fetch -prune`.
# Another command to clean up your remote tracking branches is `git remote prune <remote>`.
#
# Author: @leshill
# https://gist.github.com/leshill/9a1088a17f94cef24831
if [[ $# = 1 && $1 == '-n' ]]; then
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results