Skip to content

Instantly share code, notes, and snippets.

mydict = {'mykey': 'foo', }
class MyObj(object):
thing = 'whatever'
myobj = MyObj()
val = None
try:
mydict = {'mykey': 'foo', }
class MyObj(object):
thing = 'whatever'
myobj = MyObj()
val = getattr(myobj, 'thing', mydict['nonexistent'])
select gender, suburb, avg(salary)
from demographics
group by gender, suburb
# so MySQL will allow ?:
select gender, suburb, avg(salary)
from demographics
group by suburb
@eedeep
eedeep / gist:5565631
Last active December 17, 2015 06:28

mysqldumped --forever

Perhaps you've read some of the much tweeted [PHP hate] (http://www.codinghorror.com/blog/2012/06/the-php-singularity.html) from recent years. I used to write PHP and it is true that it works, you can get things done. The same goes for MySQL - it works and you can definitely use it to build and run successful applications. Facebook uses it. But the ["fractal of bad design"] (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) assessment of PHP could equally be applied to MySQL. Just take a look at [this screencast] (http://www.youtube.com/watch?v=1PoFIohBSM4) for a whole bunch of concrete examples. Don't get me wrong, over the years MySQL and I have had our fair share of late nights partying together till dawn, our intimate mornings nestled amongst the features of the INFORMATION_SCHEMA, timeless moments on that shitty official MySQL forum site (yes you know the one) but I'm afraid the time has come to truncate my losses and move on. You could say I've **mys

Maybe you've read some of the [PHP hate] (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) that's out there. I used to write PHP and you know, it works, you can get things done. The same goes for MySQL. I kind of feel like in this day and age MySQL is the relational database analogue of the [lingering legacy of the PHP singularity] (http://www.codinghorror.com/blog/2012/06/the-php-singularity.html).
Basically, MySQL works and you can definitely use it to build and run successful applications. Facebook uses it. But the important point to consider is that Postgres ..... is better. It's more or less a fact. How and why? Well there are numerous articles out there for you to google up but [here's a screencast] (http://www.youtube.com/watch?v=1PoFIohBSM4) that gives you a reasonable breakdown, by example.
So just like I left PHP behind, now I've left MySQL behind. You could say I've **mysqldumped** it forever. Now, [WHO'S COMIN WITH ME?!] (http://www.youtube.com/watch?v=r7ObPFtGijw)
If you're
@eedeep
eedeep / vboxip
Created April 4, 2013 03:57
~/.bashrc alias for finding the IP address of a headless virtualbox VM (in this case named "pupone") configured to get it's IP via DHCP on the network 192.168.0.x
alias vboxip="nmap -sP 192.168.0.1-254 && arp -n|grep ether|sed s/://g|grep `VBoxManage showvminfo pupone| egrep '^NIC 1'|awk '{print tolower($4)}'|sed s/,//`"