Skip to content

Instantly share code, notes, and snippets.

@bonsi
bonsi / laravel-elixir-growl-docker.md
Last active December 2, 2016 16:49
Laravel elixir remote growling from within a docker container

Laravel elixir 6 remote notifications (Growl) from within a docker container.

In /node_modules/laravel-elixir/dist/Notification.js

Replace

var _gulpNotify = require('gulp-notify');
@bonsi
bonsi / Makefile
Created November 26, 2016 11:28
Makefile - more enjoyable (shorter) docker management commands
# work in progress. inspired by serverforhackers example.
.PHONY: up down log tinker artisan test
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PWD := $(dir $(MAKEPATH))
up:
docker-compose -f laradock/docker-compose.yml up -d
@bonsi
bonsi / gnome-terminal-settings
Created November 23, 2016 16:03
gnome-terminal settings (Ubuntu 16.04.1 LTS)
[/]
new-terminal-mode='tab'
schema-version=uint32 3
[keybindings]
switch-to-tab-1='disabled'
switch-to-tab-2='disabled'
switch-to-tab-3='disabled'
new-tab='<Primary>t'
switch-to-tab-4='disabled'
@bonsi
bonsi / ssl-config
Created November 14, 2016 13:26 — forked from ivanleoncz/ssl-config
Generates self-signed SSL certificates.
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
attributes = req_attributes
prompt = no
[ req_distinguished_name ]
C = MX
ST = VE
L = XL
@bonsi
bonsi / NewMessage.php
Created October 11, 2016 14:33 — forked from sebastiaanluca/NewMessage.php
Laravel + Redis + NodeJS + Socket.io pub/sub secure server and client supporting multiple rooms, channels, users, … Add `client.js` to your client app, run `node server.js`, and trigger the Laravel event any way you want to broadcast the data.
<?php
namespace App\Events;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
class NewMessage extends Event implements ShouldBroadcast
{
@bonsi
bonsi / keybase.md
Last active January 27, 2017 19:34

Keybase proof

I hereby claim:

  • I am bonsi on github.
  • I am bonsi (https://keybase.io/bonsi) on keybase.
  • I have a public key whose fingerprint is 7169 3C20 9FEA 2122 66B6 D5D7 C72D AE9B D6EB A3A8

To claim this, I am signing this object:

@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
@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 / 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 / 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,