Skip to content

Instantly share code, notes, and snippets.

@bonsi
bonsi / Vagrantfile
Created June 23, 2015 09:31
Vagrant - Debian / MySQL / Dotdeb / PHP bootstrap
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/debian-7.4"
config.vm.box_url = "https://vagrantcloud.com/chef/boxes/debian-7.4/versions/1/providers/virtualbox.box"
config.vm.network :private_network, ip: "192.168.56.10"
@bonsi
bonsi / Vagrantfile
Last active August 29, 2015 14:23
WorkInProgess - Vagrant - Debian Jessie / Apache2 / Git
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "spoof/debian-jessie64"
@bonsi
bonsi / gist:8950e0820ec88eb5d87f
Last active August 29, 2015 14:24
Gulpfile with remote GNTP notifications (currently using localhost + ssh tunnel back to host + Growl for Windows)
var gulp = require('gulp');
var phpspec = require('gulp-phpspec');
var run = require('gulp-run');
var notify = require('gulp-notify');
var nn = require('node-notifier');
var customNotifier = notify.withReporter(function (options, callback) {
new nn.Growl().notify(options, callback);
});
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
__has_parent_dir () {
# Utility function so we can test for things like .git/.hg without firing up a
# separate process
test -d "$1" && return 0;
current="."
@bonsi
bonsi / Git push deployment in 7 easy steps.md
Created October 26, 2015 10:16 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@bonsi
bonsi / gist:28faa641acd6135d26dc
Created November 26, 2015 15:58 — forked from adamjimenez/gist:5917897
Generate thumbnails from video files using HTML5's video tag and canvas
<?php
//where you want your thumbnails to go
$thumbs_dir = 'uploads/thumbs/';
//this should be an array of video paths
$videos = array();
if( $_POST["name"] ){
// Grab the MIME type and the data with a regex for convenience
if (!preg_match('/data:([^;]*);base64,(.*)/', $_POST['data'], $matches)) {
@bonsi
bonsi / fail2ban.md
Created December 3, 2015 20:14 — forked from joecampo/fail2ban.md
fail2ban – stop HTTP(S) route abuse/brute forcing

If you're not familiar: What is fail2ban? fail2ban is an awesome linux service/monitor that scans log files (e.g. auth.log for SSH) for potentially malicious behavior. Once fail2ban is tripped it will ban users for a specified duration by adding rules to Iptables. If you're unfamiliar with fail2ban Chris Fidao has a wonderful (& free!) series about security including setting up fail2ban here.

Recently Laravel released a new feature in 5.1 to throttle authentication attempts by simply adding a trait to your authentication controller. The Laravel throttle trait uses the inputted username, and IP address to throttle attempts. I love seeing this added to a framework out of the box, but what about some of our other apps not built on Laravel? Like a WordPress login? Or even an open API etc.? Ultimately,

@bonsi
bonsi / virtualbox_vagrant_home.bat
Last active December 21, 2015 10:47 — forked from michaelklapper/virtualbox_vagrant_home.bat
Reconfigure VirtualBox and Vagrant home directory for Windows
REM # VirtualBox home directory.
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" setproperty machinefolder "X:\VirtualMachines\virtualboxImages"
REM # Vagrant home directory for downloadad boxes.
REM REG ADD HKCU\Environment /v VAGRANT_HOME /t REG_SZ /d "X:\VirtualMachines\VAGRANT_HOME"
REM - this will only set the env var for the current session. Use setx to persist it.
set VAGRANT_HOME=X:\VirtualMachines\VAGRANT_HOME
REM #########################################################################################
vagrant up
pause
@bonsi
bonsi / .bash_profile
Created January 5, 2016 10:05 — forked from JeffreyWay/.bash_profile
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@bonsi
bonsi / custom-solarized-dark.reg
Created January 10, 2016 16:06
Custom putty session color & font settings, based on https://github.com/altercation/solarized
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Solarized%20Dark%20Ivo]
"Present"=dword:00000001
"HostName"=""
"LogFileName"="putty.log"
"LogType"=dword:00000000
"LogFileClash"=dword:ffffffff
"LogFlush"=dword:00000001
"SSHLogOmitPasswords"=dword:00000001