This guide assumes a fresh install of Mac OSX 10.7 Lion.
- http://mirnazim.org/writings/python-ecosystem-introduction/
- http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
- http://effbot.org/zone/python-with-statement.htm
- http://www.python.org/dev/peps/
- http://www.mindviewinc.com/Books/Python3Patterns/Index.php
- http://stackoverflow.com/questions/986006/python-how-do-i-pass-a-variable-by-reference
- http://agiliq.com/blog/2012/06/understanding-args-and-kwargs/
#Mac OS X
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev | |
#for lxml | |
sudo apt-get install libxml2-dev | |
sudo apt-get install libxslt1-dev | |
#for mysql client | |
sudo apt-get install libmysqlclient-dev | |
# On OS X instead (assuming brew installed...) | |
brew install mysql |
# Extract Files | |
extract() { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.tar.xz) tar xvJf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; |
^[\w.%+-]+@(?:[\w-]+\.)+[A-Za-z]{2,4}$ | |
Explanation: | |
^ # Start of string. If searching in-line replace with \b | |
[\w.%+-]+ # Matches alphanumeric, _, ., %, +, or - repeatedly | |
@ # name-domain separator | |
(?: | |
[\w-]+ # Matches alphanumeric or - repeatedly | |
\. # Matches dot in domain separator | |
)+ # Matches for one domain or for multiple subdomains |
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
-
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the
secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection. -
Use production SSL certificates locally. This is annoying
After my dad died, I wanted to be able to have access any of his online accounts going forward. My dad was a Safari user and used iCloud Keychain to sync his credentials across his devices. I don’t want to have to keep an OS X user account around just to access his accounts, so I wanted to export his credentials to a portable file.
This is the process I used to create a CSV file of his credentials in the format “example.com,user,pass”. This portable format would be pretty easy to import into 1Password or Safari in the future.
The way I went about this isn’t great; it opens up more opportunities for apps to control one’s Mac through Accessibility APIs, it writes plaintext passwords to disk, and it could use some cleaning up. A better approach might leverage the security
command line tool that ships with OS X. That said, I found this method to be a fun illustration of what’s possible us
pswaminathan at home in ~/uuidbench
$ gb test -v -bench=. -test.benchmem
uuids
testing: warning: no tests to run
PASS
BenchmarkPbormanParse-4 3000000 599 ns/op 80 B/op 5 allocs/op
BenchmarkPbormanDump-4 200000 6756 ns/op 1520 B/op 60 allocs/op
BenchmarkSatoriParse-4 1000000 1149 ns/op 240 B/op 5 allocs/op
BenchmarkSatoriDump-4 3000000 584 ns/op 240 B/op 5 allocs/op
package main | |
import ( | |
"fmt" | |
"strconv" | |
"testing" | |
) | |
var ( | |
n = 12345 |