Misc 21 April 2023
    The Parable of the Physics Professor

    One of my undergrad physics professors gave notoriously difficult exams, including an extra-point question that was truly challenging.

    A brainiac friend of mine managed to get the extra-point question completely correct. Almost. He screwed up the decimal point, incorrectly putting it two places to the right.

    The professor gave him …

    More
    misc 16 January 2013
    "Python itertools.groupby : a clearer example"

    itertools.groupby allows you to group a sorted list (or any sorted iterable) by some key, giving you the grouping key and the list of items grouped by that key.

    For example, say you have a Django the model:

    class Item(models.Model):
        user     = models.ForeignKey( User, verbose_name="User", db_index …

    More
    misc 27 July 2012
    "Undo last git commit / merge"

    Note to self: I quite stupidly merged and committed an unwanted branch into master. Took a surprisingly long time to figure out how to get rid of it:

    git reset --hard HEAD^
    

    Which means reset git to one commit before the current head, effectively getting rid of the last commit …

    More
    misc 09 May 2012
    "Efficiently finding large (size and dimension) images"

    I needed to efficiently find large images (those with dimensions greater than x). Here's what I came up with:

    First, find images whose file size is greater than 3M:

    find . -name '*jpg' -size 3M > /tmp/big-receipts.txt
    

    Now, get the dimensions of each of those images using imagemagick's identify command …

    More
    misc 27 February 2012
    "Hands On With the BlackBerry Playbook: Actually Quite Nice"

    Over the weekend I attended the Blackberry hackathon with the hopes of creating an Xpenser blackberry app. The RIM folks were nice enough to give away a Playbook to everyone who presented, so I ended up with one.

    Blackberry Playbook

    I was skeptical, to say the least. I expected a sluggish, ugly …

    More
    misc 23 February 2012
    "SFTP: Specifying Port, SSH key"

    This page is helpful.

    Specifying port:

    sftp  -v -oPort=6636 -o IdentityFile=keys/my-key.ssh [[email protected]](/web/20120914064722/http://cloudflare.com/email-protection.html)
    

    More
    misc 15 February 2012
    "Student Loans Are Killing Entrepreneurship"

    If you know me you know I'm a huge fan of entrepreneurship - instead of renting yourself out to someone else, start a business that scales. Be your own pimp.

    I gave a guest lecture at UCSD recently espousing this viewpoint. You are cheap right now, I told them, so take …

    More
    misc 11 January 2012
    "How To Dynamically Import Python Modules"

    Here's how you import a python module dynamically: say your module is called "mysettings" and it's in the directory "config". Make sure you have a __init__.py in your "config" directory and use:

    mysettings = __import__("config.mysettings", fromlist=["config"])
    

    This is equivalent to

    from config import mysetings
    

    More
    misc 15 November 2011
    "How To Scan Multiple Pages Into a Single PDF on OS X"

    My new printer has a document feeder which makes scanning of multiple pages easy, but I didn't know how to kick off the scan on OS X. Turns out it's quite easy:

    • Open the OS X Preview app
    • Go to the File menu and select Import From Scanner
    • Select your …

    More
    misc 15 August 2011
    "Titanium Studio: How To View Android Log Messages"

    Apparently with Titanium Studio it's not possible to see log messages in the Titanium console.

    Here's how you see your log messages:

    adb logcat | grep "TiAPI"
    

    adb is in the tools directory of your Android sdk.

    More
    misc 27 July 2011
    "Easy way to view cookies in Chrome"

    Here's an easy way to see the cookies for the current site in Chrome:

    javascript:void(document.cookie=prompt(document.cookie,document.cookie));
    

    Via stackoveflow.

    More
    misc 04 March 2011
    "Uniforms"

    I went to a school that required uniforms (private school in England). We were forced to be uniform.

    This afternoon driving by the high school near my house I was amused to see uniforms everywhere - here a patch of girls all wearing the same types of shorts, with hair pulled …

    More
    misc 08 December 2010
    "Future of Work and New Dial Tones"

    My friend Paul Kedrosky's post on one of his main investment theses, the application of currently consumer oriented technologies to business (DropBox, Twitter, FaceBook, Yelp, …), got me thinking about how the future of work will look.

    I've made a career of working far from where I live. I've generally considered …

    More
    misc 29 November 2010
    "Generating static html from markdown in python"

    Note to self, for future reference.

    Generating static html:

    import markdown2
    file('classification.html','w').write( markdown2.markdown_path('classification.md', extras=["code-friendly"]) )
    

    More
    misc 19 November 2010
    "Retention Bonuses Don’t Work"

    Retention bonuses don't work because they only motivate presence, not contribution.

    More
    misc 08 November 2010
    "mo.com Interviews Me"

    The lovely folks at mo.com recently asked me about my experiences at Yahoo, the background and business model for Xpenser, and thoughts on funding and raising VC money. The interview has been published here, drop by and take a gander.

    More
    misc 29 October 2010
    "How To Run A Command On Multiple Linux Boxes"

    Here's a handy way of running a command on multiple boxes. In this case I wanted to check disk space on a series of machines.

    Assuming you're using bash as your shell, the following will list the hostname and run df on machines racb13 through racb28 and spit out the …

    More
    misc 23 July 2010
    "Art"

    I don't know why but I'm seriously in love with this drawing from the six year old; it seems to have a real style. Better than anything I could draw, methinks.
    Desert Scene by Kamran

    More
    misc 04 March 2010
    "How To Be A Good Participant On A Panel: Disagree"

    Mark Suster and Fred Wilson have both posted on the topic of being a good panelist. I'll throw in the best advice I ever got on the topic (from Alex, who got it from someone else):

    Disagree with other panelists.

    A panel of people agreeing with each other is generally …

    More
    misc 19 February 2010
    "Django: Using The Permission System"

    I was surprised at how little information I found on making use of Django's permission system. Here are some quick notes on one way to use it:

    Groups are groups of users. For example, you could define a group of users who have premium accounts, or have been verified in …

    More

Page 1 / 11 »