Skip to content

Instantly share code, notes, and snippets.

@breenie
breenie / gist:6240119
Created August 15, 2013 11:25
Turn off fking annoying notification centre in Google Chrome, hit this URL.
chrome://flags/
@breenie
breenie / gist:6435611
Last active December 22, 2015 07:08
Useful mod_rewrite snippets
RewriteEngine on
# Redirect from anyhost to www
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]
# Remove www from the request uri
RewriteCond %{HTTP_HOST} ^www\.
RewriteCond %{HTTPS}s ^on(s)|off
@breenie
breenie / build.xml
Created April 8, 2014 10:39
git ant tasks
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- Copied almost verbatim from: http://stackoverflow.com/questions/2974106/how-to-lookup-the-latest-git-commit-hash-from-an-ant-build-scripto-->
<available file=".git" type="dir" property="git.present"/>
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="describe"/>
@breenie
breenie / watch-dir.sh
Created November 5, 2014 11:33
Watch a directory for changes
watch "ls -lrt | tail -10"
@breenie
breenie / self-sign.sh
Last active August 29, 2015 14:09
Self sign PHPStorm
#!/usr/bin/env bash
# Lifted from http://systemterror.com/2012/11/self-signing-osx-applications/ with the addition of --deep
# Open Keychain Access and from the menu select Keychain Access > Certificate Assistant > Create a Certificate
# Name: fill in any name you like, e.g. "MyCodesign"
# Identity Type: Self Signed Root
# Certificate Type: Code Signing
codesign --deep -s "MyCodesign" -f /Applications/PhpStorm.app/
@breenie
breenie / config.php
Created November 19, 2014 17:24
Parse php config values simply
<?php
$diff = array_diff(array('one', 'two'), array_keys($input));
if (0 < count($diff)) {
throw new Exception(
sprintf(
'Missing configuration parameter%1$s "%2$s".',
1 === count($diff) ? '' : 's',
implode(', ', $diff)
@breenie
breenie / generte-symfony-2-bootstrap.sh
Created November 26, 2014 11:43
Generate a new bootstrap.php.cache in Symfony 2
#!/usr/bin/env php
./vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
@breenie
breenie / tags.json
Last active August 29, 2015 14:23
Tags
[
"Curriculum subjects -> Arabic",
"Curriculum subjects -> Art & design",
"Curriculum subjects -> Biology",
"Curriculum subjects -> Business Studies",
"Curriculum subjects -> Chemistry",
"Curriculum subjects -> Citizenship",
"Curriculum subjects -> Computing",
"Curriculum subjects -> Design & technology",
"Curriculum subjects -> English",
@breenie
breenie / ssh.md
Created July 17, 2015 08:50
SSH crib sheet

SSH crib sheet

Generate fingerprint

ssh-keygen -lf ~/.ssh/id_rsa

Keyscan to known_hosts

@breenie
breenie / ftp.sh
Created August 11, 2015 13:40
FTP server on ubuntu 14.04 x64
#!/bin/env bash
sudo apt-get update
apt-get install vsftpd
# Modify /etc/vsftp.conf
useradd -m ldsc -s /usr/sbin/nologin
passwd ldsc