Skip to content

Instantly share code, notes, and snippets.

View adfinlay's full-sized avatar

Andrew Finlay adfinlay

View GitHub Profile
#!/bin/bash
# Disclaimer - make backups, use at your own risk.
#
# Based on this comment: http://stackoverflow.com/a/13944924/843067
# Views and stored procedures have to be done separately.
OLDDB="old_db_name"
NEWDB="new_db_name"
MYSQL="mysql -u root -pyour_password "
<?php
class FeatureContext extends MinkContext {
/**
* Take screenshot when step fails. Works only with Selenium2Driver.
* Screenshot is saved at [Date]/[Feature]/[Scenario]/[Step].jpg
*
* @AfterStep
*/
@adfinlay
adfinlay / backstretch-overlay.css
Created October 23, 2014 09:51
Add pattern overlay to backstretch image
.backstretch:before {
content: "";
width: 100%;
height: 100%;
background: url("/images/pattern.png");
position: absolute;
}
colorscheme:symfony
cs_re:yellow:"[^"\\]*(\\.[^"\\]*)*"
cs_re:cyan:^\[....-..-.. ..:..:..\]
cs_re:green:.*DEBUG.*
cs_re:red:^.*(WARNING|ERROR|CRITICAL).*$
cs_re:blue:.*INFO.*
@adfinlay
adfinlay / remove_files_with_prompt.sh
Created December 5, 2014 13:40
Remove all files matching search, with prompt
sudo find / -name 'filename.file' -exec rm -i {} \;
@adfinlay
adfinlay / no_primary_keys.sql
Created December 30, 2014 12:46
Get all MySQL tables without primary or unique keys
SELECT t.table_schema,t.table_name,engine
FROM information_schema.tables t INNER JOIN information_schema .columns c
on t.table_schema=c.table_schema and t.table_name=c.table_name
GROUP BY t.table_schema,t.table_name
HAVING sum(if(column_key in ('PRI','UNI'), 1,0)) =0;
@adfinlay
adfinlay / processlist.sql
Created December 30, 2014 12:47
Add WHERE clauses to SHOW FULL PROCESSLIST
SELECT * FROM information_schema.processlist WHERE USER="system user";
@adfinlay
adfinlay / yosemite_cpu_id
Created January 6, 2015 12:07
Set CPU ID correctly in VirtualBox for Yosemite
VBoxManage modifyvm "vmname" --cpuidset 00000001 000306a9 00020800 80000201 178bfbff
@adfinlay
adfinlay / install_redis.sh
Created March 9, 2015 14:28
Install elasticache-compatible Redis
# cleaning up previous installations
sudo /etc/init.d/redis_6379 stop >> /dev/null
sudo update-rc.d -f redis_6379 remove >> /dev/null
sudo rm -rf /tmp/redis-src /etc/redis /var/redis /var/redis/6379
sudo mkdir /etc/redis /var/redis /var/redis/6379
# compiling from source (2.8.6 is the currently supported version in Amazon ElastiCache)
mkdir /tmp/redis-src && cd /tmp/redis-src
wget https://github.com/antirez/redis/archive/2.8.6.tar.gz --quiet
tar -xzvf 2.8.6.tar.gz >> /dev/null
backend jsonp_varnish {
.host = "localhost";
.port = "80";
}
#------------- begin jsonp functionality -------------#
# How the jsonp_template_backend dispatches to the ESI generating code:
sub jsonp_throw_error_recv {
if (req.url == "/JSONP-ESI-TEMPLATE") {
error 760;