Skip to content

Instantly share code, notes, and snippets.

View petercossey's full-sized avatar

Peter Cossey petercossey

View GitHub Profile
@petercossey
petercossey / hack.sh
Created March 31, 2012 11:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@petercossey
petercossey / gist:2495173
Created April 26, 2012 01:57
Drush - change user password 6.x and lower.
drush user-password someuser --password="gr3@tP@$s"
@petercossey
petercossey / vhosts-boilerplate
Created May 7, 2012 07:30
Apache vhosts boilerplate
<VirtualHost *:80>
ServerAdmin user@host
ServerName some.hostname.com
DocumentRoot /path/to/root/dir
<Directory /path/to/root/dir>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
@petercossey
petercossey / mysql-new-db-snippet
Created May 7, 2012 10:06
Setup a new database and database user
CREATE DATABASE db_name;
GRANT USAGE ON *.* TO 'db_user'@'hostname' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON db_name.* TO 'db_user'@'hostname';
# Shorter
create database db_name;
grant all on db_name.* to 'db_user' identified by 'password';
flush privileges;
@petercossey
petercossey / htaccess-redirect
Created May 14, 2012 11:15
htaccess redirect
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^original-url.com [nc]
RewriteRule ^(.*)$ http://www.where-you-want-it-to-go.com/ [r=302,nc]
# Redirect domain and all subdomains
RewriteCond %{http_host} ^(.*)original-domain\.com [nc]
RewriteRule ^(.*)$ http://www.new-domain.com [r=302,nc]
@petercossey
petercossey / nifty-css-from-the-web
Created May 16, 2012 00:06
Nifty CSS from the web
#button > .background {
position: absolute;
-webkit-animation: pulseCircle 2s ease-out infinite;
-moz-animation: pulseCircle 2s ease-out infinite;
-o-animation: pulseCircle 2s ease-out infinite;
-ms-animation: pulseCircle 2s ease-out infinite;
}
@petercossey
petercossey / php-stdin
Created May 16, 2012 00:18
PHP scripting - record input from STDIN
<?php
function nfact($n) {
if ($n == 0) {
return 1;
}
else {
return $n * nfact($n - 1);
}
}
@petercossey
petercossey / govhack-mock-json.js
Created June 2, 2012 12:29
Govhack mock JSON
{
"response" : {
"responseNum" : 3,
"timeRange" : {
"begin" : "2012-01-10",
"end" : "2012-03-15"
},
"importanceTotal" : 1600, // the sum of all the words of all the bills in all the topics
"totalSpeakers" : 28,
"topics" : {
@petercossey
petercossey / artpost-html-newsletter.html
Created June 15, 2012 11:10
artpost html newsletter
<style type="text/css">
P {
LINE-HEIGHT: 16px
}
body {
background-color: #EBEBEB;
}
</style>
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#ebebeb">
<tbody>
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDugg4TSLrPbeSCCmNmlV8n7Q8zAb4ZNjyrFKWPS1NTUHvzjCr6uNiIMFNRzM/wANR/Ujl814vb7FjFkWXU9FlLu9KOCsrKqdN4Bg6Q64U+YDir43yoF0EXZ4K3X752Lag6JkAC16GMvKeCc/wl6pPnAx3bdwcK/fWTA7dmjU5fuGAahFNJXzkXmrPOGXAzHZNZfOK9g7FOb2oF0KLEcCT9R6NkCfWGTXcVpEXYKZzGFcxMdi3zbVucTiI0t22x9nYxn2Wchy75DNEaYWD4yoIOwaeEWNgjMcA7UDdITpNh78uuqtGCqEmxdBcUXkSp9tbGMyqjthq1yg8qq6BqwcaL peter@peter-thinkpad-x220