Skip to content

Instantly share code, notes, and snippets.

Pieter Scheffers PieterScheffers

Block or report user

Report or block PieterScheffers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View minimal-analytics-snippet.js
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@PieterScheffers
PieterScheffers / mysql-docker.sh
Created Jan 31, 2018 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
View mysql-docker.sh
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
View docker-extend-entrypoint.sh
#!/bin/bash
# Custom scripts here
echo "This is an extended entrypoint!"
# Run the original entrypoint located at
# /docker-entrypoint.sh
exec /docker-entrypoint.sh "$@"
@PieterScheffers
PieterScheffers / gist:1afefd1d464897d408eb8c025c426e83
Created May 8, 2017 — forked from sheepkiller/gist:9740b280ba199cdc5baa
Quickstart : Simple docker-registry on FreeBSD
View gist:1afefd1d464897d408eb8c025c426e83
root@dcoker-registry:/root # pkg install -y py27-supervisor libevent2 py27-pip-1.5.6
Updating repository catalogue
FreeBSD repository is up-to-date
All repositories are up-to-date
pkg: mplayerxp has a missing dependency: win32-codecs
The following 10 packages will be affected (of 0 checked):
New packages to be INSTALLED:
py27-supervisor: 3.0_1,1
py27-meld3: 0.6.8_1
@PieterScheffers
PieterScheffers / scroll-monitor.js
Created Mar 8, 2017 — forked from jacob-beltran/scroll-monitor.js
React Performance: Scroll Monitor Example
View scroll-monitor.js
class ScrollMonitor extends React.Component {
constructor() {
this.handleScrollStart = this.startWatching.bind( this );
this.handleScrollEnd = debounce(
this.stopWatching.bind( this ),
100,
{ leading: false, trailing: true } );
}
componentDidMount() {
@PieterScheffers
PieterScheffers / OpenWithSublimeText3.bat
Created Jan 2, 2017 — forked from cstewart90/OpenWithSublimeText3.bat
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 10)
View OpenWithSublimeText3.bat
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@PieterScheffers
PieterScheffers / post-merge
Created May 26, 2016 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
View post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@PieterScheffers
PieterScheffers / js-micro.js
Created May 23, 2016 — forked from yuval-a/js-micro.js
Javascript micro-optimizations
View js-micro.js
// Array literal (= []) is faster than Array constructor (new Array())
// http://jsperf.com/new-array-vs-literal/15
var array = [];
// Object literal (={}) is faster than Object constructor (new Object())
// http://jsperf.com/new-array-vs-literal/26
var obj = {};
// property === undefined is faster than hasOwnProperty(property)
// http://jsperf.com/hasownproperty-vs-in-vs-undefined/17
@PieterScheffers
PieterScheffers / agent.cmd
Created Apr 25, 2016 — forked from Shoozza/agent.cmd
Make Cmder work with ssh-agent
View agent.cmd
@ECHO OFF
REM Set default sock file
SET SSH_AUTH_SOCK=/tmp/ssh-agent.sock
REM Check socket is available
IF NOT EXIST "%TMP%\ssh-agent.sock" GOTO:RUNAGENT
REM Check if an ssh-agent is running
FOR /f "tokens=*" %%I IN ('ps ^| grep ssh-agent ^| sed "s/^ *\([0-9]\+\) .*/\1/"') DO SET VAR=%%I
You can’t perform that action at this time.