Skip to content

Instantly share code, notes, and snippets.

@colinmollenhour
colinmollenhour / mysql_monitor.sh
Last active March 6, 2019 02:03
MySQL Monitor (like 'redis-cli MONITOR')
#!/bin/bash
#
# Monitor MySQL queries
# @author Colin Mollenhour
set -e
mysql="mysql"
test="test"
bash="bash"
@chrisyip
chrisyip / vagrant-lamp.sh
Created May 8, 2013 11:58
Vagrant shell script for LAMP.
#!/usr/bin/env bash
apt-get update
echo mysql-server-5.5 mysql-server/root_password password PASSWORD | debconf-set-selections
echo mysql-server-5.5 mysql-server/root_password_again password PASSWORD | debconf-set-selections
apt-get install -y mysql-common mysql-server mysql-client
apt-get install -y apache2
@pfulton
pfulton / webkit-svg-heightfix.js
Created December 11, 2012 15:31
Webkit SVG height bugfix
// jQuery fix for Webkit SVG height bug.
// Documented here: https://bugs.webkit.org/show_bug.cgi?id=82489 & http://www.brichards.co.uk/blog/webkit-svg-height-bug-workaround
// Found via: http://stackoverflow.com/questions/7570917/svg-height-incorrectly-calculated-in-webkit-browsers
function fixWebkitHeightBug(){
var svgW = 658;
var svgH = 500;
var curSVGW = $('#svg-container').width();
var newSVGH = heightInRatio(svgH,svgW,curSVGW);
@colinmollenhour
colinmollenhour / cleanCache.php
Created May 17, 2012 00:50
Simplified cache cleaning script for production updates.
<?php
/**
* Set global/skip_process_modules_updates to '1' in app/etc/local.xml and
* then use this script to apply updates and refresh the config cache without
* causing a stampede on the config cache.
*
* @author Colin Mollenhour
*/
umask(0);
ini_set('memory_limit','512M');
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {