Skip to content

Instantly share code, notes, and snippets.

@4lun
4lun / aws-upload-ssl-certificate.sh
Created December 18, 2015 12:45
Upload SSL certificate to AWS IAM for use with Cloudfront
aws iam upload-server-certificate --server-certificate-name domain_com --certificate-body file:///absolute/path/domain_com.crt --private-key file:///absolute/path/domain_com.key --certificate-chain file:///absolute/path/domain_com.ca-bundle --path /cloudfront/static/
@4lun
4lun / piwik.local
Last active January 2, 2016 14:56
Piwik nginx config (including way to rename piwik client files)
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/piwik;
index index.php index.html index.htm;
server_name piwik.local;
location / {
@4lun
4lun / 2015_12_21_172600_add_additional_session_columns_for_laravel_5-2.php
Created January 6, 2016 11:35
Upgrade to Laravel 5.2: Migration for sessions table
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAdditionalSessionColumnsForLaravel52 extends Migration
{
/**
* Run the migrations.
*/
@4lun
4lun / course-structure-msccs-birkbeck.md
Last active August 14, 2024 17:44
Course Structure - Computer Science (MSc) at Birkbeck University, London
@4lun
4lun / reddit-unsubscribe-all-subreddits.js
Last active January 7, 2025 17:28
Unsubscribe from all subreddits
// Visit https://www.reddit.com/subreddits/ and run the following in console (browser dev tools)
// Wait until all the buttons have visibly toggled, refresh page to confirm.
$('.fancy-toggle-button .remove').each(function(i, elem) { setTimeout(function(){ $(elem).trigger('click'); }, i*500) });
@4lun
4lun / bem-grid.scss
Last active August 29, 2016 09:53
Basic BEM CSS Grid
$breakpoint-lrg: 780px;
$breakpoint-med: 450px;
$grid-gutter: 15px;
.grid {
@extend %clearfix;
margin-left: -($grid-gutter);
&__col {
float: left;
@4lun
4lun / git-backup.sh
Created March 15, 2016 10:35
Create a complete single file backup (bundle) of a local git repository
git bundle create ../"${PWD##*/}".bundle --all
@4lun
4lun / setup-lolcommits.sh
Last active July 14, 2016 15:50
Setup script for lolcommits on OSX (requires brew) or Debian/Ubuntu (apt-get): https://github.com/mroth/lolcommits
#!/usr/bin/env bash
if [ "$(uname)" == "Darwin" ]; then
echo -e "\n# Installing dependencies\n"
brew install imagemagick
brew install ffmpeg
echo -e "\n# Installing lolcommits\n"
sudo gem install lolcommits
@4lun
4lun / laravel-sql-capture.php
Created June 1, 2016 14:43
Easily capture full SQL queries in Laravel (tested in 5.2), useful for quickly inspecting queries inside controllers and scoping certain blocks of code
<?php
\DB::enableQueryLog();
// Code that triggers DB queries (User::create(), User::with('relation')->get(), etc)
$pdo = \DB::getPdo();
$queries = collect(\DB::getQueryLog())->map(function($log) use ($pdo) {
$query = $log['query'];
foreach($log['bindings'] as $binding) {
@4lun
4lun / gogs.conf
Created June 3, 2016 12:53
Supervisor configuration for gogs (/etc/supervisor/conf.d/gogs.conf)
[program:gogs]
directory=/home/git/go/src/github.com/gogits/gogs/
command=/home/git/go/src/github.com/gogits/gogs/gogs web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gogs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB