Skip to content

Instantly share code, notes, and snippets.

@adrienbrault
adrienbrault / purge.sh
Created September 24, 2012 10:02
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@itsbalamurali
itsbalamurali / gravatar_function.php
Created November 27, 2012 07:08
Simple PHP Gravatar Function
<?php
/**
Load a gravatar.
*/
function gravatar($email = '', $rating = 'pg') {
$default = "path/to/defava.png"; // Set a Default Avatar
$email = md5(strtolower(trim($email)));
$gravurl = "http://www.gravatar.com/avatar/$email?d=$default&s=60&r=$rating";
return '<img src="'.$gravurl.'" width="60" height="60" border="0" alt="Avatar">';
@brianclements
brianclements / Commit Formatting.md
Last active July 3, 2024 08:15
Angular Commit Format Reference Sheet

Commit Message Format

This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.

@v-jacob
v-jacob / Mailhog Bash Script (upstart)
Last active December 5, 2018 12:22
Mailhog Bash Script
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
@msankhala
msankhala / laravel-multiple-env-setup.php
Last active February 29, 2024 04:53
Setup Multiple Environment for Laravel 5 Developers Way
<?php
/*
|--------------------------------------------------------------------------
| Follow this instructions:
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.
@rponte
rponte / get-latest-tag-on-git.sh
Last active July 3, 2024 19:27
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# 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
@Rich-Harris
Rich-Harris / service-workers.md
Last active July 1, 2024 06:33
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@yetanotherchris
yetanotherchris / cron_task.sh
Created September 5, 2016 09:45
Run cron inside a docker container.
env - `cat /root/env.sh` /bin/bash -c $1 >> /var/log/cron.log 2>&1
@muihlinn
muihlinn / Kernel.php
Last active May 31, 2022 18:19 — forked from davidrushton/Kernel.php
Laravel >=5 Queue monitoring in Shared Hosting (using queue:work) with auto restart.
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**