Skip to content

Instantly share code, notes, and snippets.

View aaronbbrown's full-sized avatar

Aaron Brown aaronbbrown

View GitHub Profile
@aaronbbrown
aaronbbrown / gist:2428910
Created April 20, 2012 14:01
skypegerian
Hello  Aarron,  
I have been in search of someone with this last name" Aarron,so when I saw your name I was pushed to contact you and see how best we can assist each other. I am Mr Frank Wilus, a Banker here in Ghana. I believe it is the wish of God for me to come across you on skype now. I am having an important business discussion I wish to share with you which I believe will interest you because, it is in connection with your last name and you are going to benefit from it.
One Late Mr Ahmad R. Aarron,a citizen of your country had a fixed deposit with my bank in 2004 for 36 calendar months, valued a US$8,400,000.00 (Eight Million, Four Hundred Thousand US Dollars) the due date for this deposit contract was the 16th of January 2007.Sadly Ahmad  was among the death victims in the May 26 2006 Earthquake disaster in Jawa,Indonesia that killed over 5,000 people. He was in Indonesia on a business trip and that was how he met his end.  My bank management is yet to know about his death, I knew about it because h
@aaronbbrown
aaronbbrown / gist:2368044
Created April 12, 2012 15:15
How to test an erb
1 [11:13:09] aaron@gaeta-wifi:~$ cat /tmp/foo.erb
my name is <%= name %>
0 [11:13:14] aaron@gaeta-wifi:~$ erb -x -T '-' /tmp/foo.erb > /tmp/foo.rb
0 [11:13:37] aaron@gaeta-wifi:~$ vim !$
#!/usr/bin/env ruby
name = "Aaron" # ADD THIS
_erbout = ''; _erbout.concat "my name is "; _erbout.concat(( name ).to_s); _erbout.concat "\
n"
; _erbout.concat "\n"
@aaronbbrown
aaronbbrown / hack.sh
Created March 31, 2012 12:39 — 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
#
@aaronbbrown
aaronbbrown / gist:2245780
Created March 30, 2012 02:06
exclusion query notes (sakila)
SELECT title FROM film f JOIN inventory i USING (film_id) LEFT JOIN rental r USING (inventory_id) WHERE r.inventory_id IS NULL;
mysql> EXPLAIN SELECT title FROM film f JOIN inventory i USING (film_id) LEFT JOIN rental r USING (inventory_id) WHERE r.inventory_id IS NULL\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: f
type: index
possible_keys: PRIMARY
key: idx_title
@aaronbbrown
aaronbbrown / gist:2245742
Created March 30, 2012 01:58
Exclusion Query Notes (employees)
$ (for x in {1..100}; do echo 'select * from departments d where (select count(*) from dept_emp de where d.dept_no = de.dept_no) = 0;'; echo; done ) | ./mk-query-profiler -u root --database=employees
+----------------------------------------------------------+
| 100 (0.1104 sec) |
+----------------------------------------------------------+
__ Overall stats _______________________ Value _____________
Total elapsed time 11.596
Questions 100
COMMIT 0
------- TRX HAS BEEN WAITING 42 SEC FOR THIS LOCK TO BE GRANTED:
TABLE LOCK table `db`.`table` trx id 4617 lock mode AUTO-INC waiting
------------------
TABLE LOCK table `db`.`table` trx id 4617 lock mode AUTO-INC waiting
@aaronbbrown
aaronbbrown / gist:1740615
Created February 4, 2012 22:16
analyze table blog reproduce 2
session1> SELECT RUN_LONG_TIME FROM table;
session2> ANALYZE TABLE table;
session3> SELECT * FROM table WHERE id=123;
@aaronbbrown
aaronbbrown / gist:1740580
Created February 4, 2012 22:11
analyze table blog reproduce 1
session1> SELECT RUN_LONG_TIME FROM table;
session2> SELECT * FROM table WHERE id = 123
@aaronbbrown
aaronbbrown / gist:1740568
Created February 4, 2012 22:09
analyze table blog mysql.err
83109 production.table Locked - write High priority write lock
83109 production.table Locked - read Low priority read lock
@aaronbbrown
aaronbbrown / gist:1740562
Created February 4, 2012 22:08
analyze table blog processlist
mysql> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO <> 'NULL' ORDER BY TIME;
*************************** 1. row ***************************
ID: 19210373
USER: me
HOST: localhost
DB: production
COMMAND: Query
TIME: 0
STATE: executing
INFO: SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO <> 'NULL' ORDER BY TIME