Skip to content

Instantly share code, notes, and snippets.

View mertenvg's full-sized avatar
🔍
Looking for a new opportunity #opentowork

Merten van Gerven mertenvg

🔍
Looking for a new opportunity #opentowork
View GitHub Profile
@mertenvg
mertenvg / mkv2mp4.sh
Last active April 30, 2019 21:56
Convert *.mkv to *.mp4 with ffmpeg
ls *.mkv | sed -E -e 's/^(.+)[.][^.]+$/ffmpeg -i "&" -vcodec copy -acodec aac "\1.mp4"/g' | sh
@mertenvg
mertenvg / current-tag.sh
Created December 29, 2014 12:17
Retrieve the current git tag from HEAD
git name-rev --tags --name-only $(git rev-parse HEAD)
@mertenvg
mertenvg / chain-callback-func-list.js
Created July 14, 2015 12:00
Chain the actions and callbacks so with the final callback is the final function called in the chain. fw -> f1 -> fw -> f2 -> fw -> f3 -> callback
var gtmActions = {
"a": function (callback) {
console.log("a");
window.setTimeout(callback, 500)
},
"b": function (callback) {
console.log("b");
window.setTimeout(callback, 500)
},
"c": function (callback) {
git ls-files --stage | grep 160000
@mertenvg
mertenvg / main.go
Last active January 30, 2016 01:31
Method values and method expressions play
// http://play.golang.org/p/YbcN6-hLq-
//
package main
import "fmt"
type Methoder interface{
Method()
}
@mertenvg
mertenvg / start-ssh-agent.sh
Created February 2, 2016 10:36
Add to ~/.bash_profile to start ssh-agent when starting a terminal
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@mertenvg
mertenvg / work-example-two.go
Created March 6, 2016 15:08
An example of handling errors using a task list
package main
import (
"errors"
"fmt"
)
// Task represents a callable task to be executed
type Task func()
@mertenvg
mertenvg / example.go
Last active March 6, 2016 18:36
An example of handling errors using a task list
package main
import (
"errors"
"fmt"
)
// Task represents a callable task to be executed
type Task func() error
@mertenvg
mertenvg / example.go
Created March 6, 2016 18:37
Another example using a task list to handle errors
package main
import (
"errors"
"fmt"
)
// Task represents a callable task to be executed
type Task func()
@mertenvg
mertenvg / example.go
Created March 7, 2016 11:32
Another (simpler) example using a task list to handle errors
package main
import (
"errors"
"fmt"
)
// Task represents a callable task to be executed
type Task func() error