Skip to content

Instantly share code, notes, and snippets.

View dan-palmer's full-sized avatar
👨‍💻

Dan Palmer dan-palmer

👨‍💻
View GitHub Profile
@dan-palmer
dan-palmer / swap-commands.txt
Created July 10, 2012 09:24
Enable Disable OSX Swap etc
# check swap usage
sysctl vm.swapusage
# disable encrypted swap - SNOW LEOPARD
sudo defaults write /Library/Preferences/com.apple.virtualMemory UseEncryptedSwap -boolean no
# disable encrypted swap - LION
sudo defaults write /Library/Preferences/com.apple.virtualMemory DisableEncryptedSwap -boolean yes
# disable swap
@dan-palmer
dan-palmer / mysql-table-sizes-for-db.sql
Created July 10, 2012 09:27
Get mysql table sizes for a particular database
SELECT TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
FROM information_schema.TABLES WHERE table_schema = "*DATABASE_NAME*";
@dan-palmer
dan-palmer / bash_profile
Created July 10, 2012 09:50
bash profile stuff
export CLICOLOR=1 # colour stuff
export LSCOLORS=GxFxCxDxBxegedabagaced
alias ls='ls -GFahlrt'
alias updatelocate='sudo /usr/libexec/locate.updatedb'
export PATH="/usr/local/mysql/bin:$PATH"
export HISTCONTROL=ignoreboth:erasedups # no duplicate entries
shopt -s histappend # append history file
@dan-palmer
dan-palmer / mbpr-eclipse-hack
Created July 18, 2012 21:46
Fix Eclipse For MacBook Retina
Do "Show package contents" on the Eclipse.app.
Edit Contents/Info.plist.
Just above:
</dict>
</plist>
Place this:
@dan-palmer
dan-palmer / postresql_running_check
Created August 14, 2012 17:03
Check POSTGRES is running
netstat -an | grep PG
@dan-palmer
dan-palmer / rvm-add
Created August 15, 2012 22:49
Add RVM
# Load RVM into a shell session *as a function* (in ~./bashrc or ~/.bash_profile)
echo [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" >> ~/.bashrc
source ~/.bashrc
# incase of bullshit gcc/llvm issue do for 1.9.2 version..
# rvm install ruby-1.9.2 --with-gcc=clang
SELECT * FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_NAME = 'TABLE_NAME_HERE';
@dan-palmer
dan-palmer / akka-test.scala
Last active December 10, 2015 11:49
hello world akka example
object TestAkka extends App {
import akka.actor._
class TestActor extends Actor {
def receive = {
case "hello" => println("hello world")
case _ => println("something else")
}
}
(function() {
var root = this;
var BackboneMock = (function() {
if(typeof Backbone === 'undefined') {
throw '"Backbone" is undefined, make sure you have loaded ' +
'backbone.js before using this mock utility';
}
// Override Backbone.sync
// because we want to mock the requests
<html>
<head>
<meta charset="utf-8">
<title>Base</title>
<!-- Styles -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/css/bootstrap.css"></link>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/css/bootstrap-responsive.css"></link>