Category Archives: Mental Note: Add Category

Mental Note: Add Category

Patterns: bootstrapping Python/SublimeText projects

I consider myself really lazy. So here’s my basic workflow of home-grown commands I go through whenever I work on a Python project.

Some notes before I dive in:

  • replace  $PROJECT with the name of your project. I keep a consistent name between projects so I can use the directory name for other things.
  • some tedious things I alias, some I don’t
# everything has to live somewhere
md $PROJECT
# equivalent to: mdkdir $PROJECT && cd $PROJECT
# my alias: md () { mkdir -p "$@" && cd "$@"; }

# Using virtualenvwrapper, make a virtualenv the same name as the project
mkvirtualenv $PROJECT

# These next steps happen automatically in my global postactivate
# Give this virtualenv its own ipython configuration so it has its own ipython history
mkipythonconfig
# change my tab title to the name of this virtualenv so I can tell my tabs apart
echo -e "\033];$(basename $VIRTUAL_ENV)\007"
# my alias: tit() { echo -e "\033];$@\007" }

# This makes it so when I `workon $PROJECT`, I automatically cd to it.
# Sometimes, this is undesirable, but `cd -` will take you back.
setvirtualenvproject
# likewise I have a function named `work` that activates or creates the virtualenv:
function work {
  # assumes `mkvirtualenv` exists
  local env_name=$(basename $PWD)
  workon $env_name
  if [ $? -ne 0 ]; then
    echo "Shall I create $env_name it for you? [Yn]"
    read -n 1 sure
    if [ -z "$sure" ] || [ "$sure" = 'y' ] || [ "$sure" = 'Y' ]; then
      mkvirtualenv $env_name
      setvirtualenvproject
    fi
  fi
}

# create a sublime text 2 project with a SublimeJEDI configuration
mksublconfig > ~/Documents/$PROJECT.sublime-project
# source: https://github.com/crccheck/dotfiles/blob/master/bin/mksublconfig

# Create an .env file to store configuration like DJANGO_SETTINGS_MODULE
# Works in conjunction with autoenv.
touch .env

# If I'm creating a new project, I create an empty initial commit so I can
# squash and rebase things from the beginning.
git init
git initempty
#  initempty = !git init && git commit -m 'initial commit (empty)' --allow-empty
Mental Note: Add Category

TBT: Doom mooD

doom mood

I posted about this a long time ago, but I was cleaning my hard drive and found this screenshot and I need to brag about how awesome Doom mooD was:

  1. The face animated
  2. The face got bloodier the higher the CPU usage got
  3. The expression changed depending on how quickly CPU usage changed
  4. Doomguy’s face turns to look at your mouse pointer when it enters the widget
  5. A testament to the original id design, this little bar packs a ton of information
  6. iddqd
Demo of the face animation of Doom mooD

2006 me was cleverer than I remember. I was mindful of overhead, made my own crude bitmap font, and was doing some pretty clever JavaScript for 2006.

I even found my original README:

This widget was born from boredom. I saw a Doom screenshot and thought
to myself that the status bar of Doom would make an entertaining
system monitor, and so I made it in Konfabulator.

I never though it would be all that useful, but I must say, I surprise
even myself. Turns out I use this widget ALL the time. And watching
the face is quite entertaining. So entertaining in face I made a
special face-only mode for the widget. The face mode is excellent
because you can put the face anywhere and he blends in. And a quick
glance tells you how your system is doing. (HINT: blood = bad).

I must warn you, one side effect of using this widget is that I
started to stress my system on purpose, just to get the guy to make
cooler, bloodier, faces.

== Usage Tips ==
To the right of the memory indicator, there are three indicators.
The first one shows if you have a CD or DVD inserted. Clicking will
open it.
The second one will show you if your volume is muted.
The third one will give info about the Trash/Recycle Bin. Clicking
will open it.

== Weapon Slots ==
These are the indicators labelled '2' through '7' directly left of
the face. In Doom mooD, they are used as quick launchers.

To add an entry, simply drag and drop what you want to launch onto
a number. The widget will remember this entry between sessions.

To clear an entry, right click and select 'Clear'

To launch an entry, right click and select 'Launch'
or while the widget is focused, type the number corresponding to entry.

The entry can be anything. A link, a program, a document, a picture, etc.

== Side Meters ==
On the far right, there are four meters. To set these, go into
preferences and check the \"Side Meters\" tab. The DISK meter will not
show anything until you set a drive for it to monitor. To do this,
right click on the DISK text and select the drive from the context
menu. If you do not see drives in the context menu reposition the
mouse and try again.

Note: The Virtual Memory meter isn't very accurate.

== How To Read the Face ==
Ok, so you know the more beat up and bloody he gets, the worse off
your system is. The blood corresponds to CPU load and memory load.
When he grimices in pain, your CPU load just went up. There are two
levels of this. And finally, when he's grinning, your CPU load just
went down.

It's fun to enable face-mode, and put the face in the middle of an
analog clock face, or interacting with something on your desktop, etc.
You get the idea.

== Performance Concerns ==
Since I use a lot of custom fonts, Konfabulator uses more memory
than you'd think. For each digit, K! loads a copy of the entire font
table. I might be able to reduce it further by breaking up the images
into separate files, but I'm satisfied with the status quo. Scaling
the graphics larger for the bar exponentially increases the number
of page faults generated.

The graphics are copyright 1993 ID Software, and used with permission.

Changelog

1.4.1 (9.10.2006)
+ fixed zOrder of new custom hovertips
+ turned off debug mode
* updated icon

1.4 (7.23.2006)
+ can Empty Trash from widget
+ new custom hovertips show even when widget is not focused

1.3 (1.29.2006)
+ Updates split up to be more efficient, some meters can be disabled now.
  (fixes problems people had with high utilization when accessing the disk)
* Digit packaging changed, should very slightly reduce pagefaults and
  memory usage, but increases package size.
+ New weird face shows up less often.
- fixed bug where volume didn't change scale.
+ widget now takes a 5 second nap when computer wakes up

1.2 (1.5.2006)
+ New Option: Reverse CPU/Memory. When enabled, CPU/Memory count down from 100,
  akin to health going from 100 to 0
- fixed bug that kept some faces from appearing
+ Weapon Slots now active. See documentation above to see how to use them.
* minor optimizations
+ Tooltips added to side meters
* Changed free space calculation method to Round from Floor

1.1 (12.27.2006)
+ The four meters on the right are now determined by preferences
+ Added WiFi side meter option
+ Disk meter has to be set by the user now (right click on \"DISK\")
- Redid some code because of the 3.0 Engine 

1.0.1
- bugfix

1.0
- First Public Release

  TODO:
  reduce pagefaults
  battery usage statistics
Mental Note: Add Category Nerd

HTML/CSS Best Practices

In the past, whenever I’ve done HTML, I’ve been bipolar. Either do whatever had to get done just to get the page rendered right, or stick to the lofty tenets of html5 and write semantic markup. Now that I’ve bounced between those two for a while now, I’ve learned a few things:

  • Doing everything semantically ends up counter-productive. Nothing generates document outlines correctly, and writing the CSS for having many H1 and H2 tags is going to be a nightmare. You’re going to end up sticking random elements in your <header> tags, and <hgroup> might as well not exist.
  • Likewise, surprise surprise, just hacking things together makes a mess.
  • Try to arrange your markup in this basic pattern: section > header + .content + footer. Making sure your footer does clear: both; will also make your section act like it has a clearfix class.
  • You can never have too many container elements. They let you mimic box-sizing: border-box, do border tricks, and do z-index fixes.
  • Your reset/normalize CSS should be designed to make body text look good, not the rest of the site.
  • Use SCSS or LESS. Which one to use? I lean towards SCSS because it has Compass, but Bootstrap uses LESS. I really don’t care which one I end up with.
  • Don’t rely on Compass. Treat it as a nice way to generate shortcuts for cross-browser compatibility and making sprites, nothing more.
  • Margins should never be applied to the tops, only bottoms. Failure to follow this will result in random ragged top edges.
  • When deciding if you should use margins or paddings, don’t consider if things collapse first, assume borders and paddings first. Cycle through debug css. As a general rule, structure tags will end up with paddings and tags inside structure will end up with margins.
  • If you do a grid layout using floats, make sure it also works at browser zoom levels.

Hopefully I’ll come back and expand on each of those points in the future…

Mental Note: Add Category

Fit Check

Notes on how major brands fit me.

Banana Republic

  • pants – most are too tight, though these fit well:
    • classic fit: 30/30
    • kentfield straight-fit – 31/30, 30/30 is ok too

Burberry

  • shirts – S waist good, shoulders tight

CK

  • shirts – S good fit
  • pants – too tight
  • jackets – M good fit

John Varvatos

  • polos – good fit

KUHL

pants – good fit

H&M

  • shirts – good fit too loose
  • pants – too tight

LEVIs

pants – good fit

Zara

shirts – sleeves too tight

pants – tight

American Rag (Macy’s house brand)

pants – loose to baggy

Merona (Target house brand)

shirts – maybe if I gain 30 pounds

pants – ok I think

Old Navy

pants – crotch too tight

diy Mental Note: Add Category

Cheap/Ugly/Functional shelving

As much as I’m a fan of metro shelving and gorilla racks. I was curious if I could throw together some cheap wood to make shelves. This is the first design I came up with.

And here’s the first version I made:

It’s basically my version 0, but I didn’t include the supports in the middle. It seemed strong enough as I was putting it together that I opted not to use them.

I updated the design and build another one today. Some changes:

  • instead of two 1×4, I use a 1×3 and a 1×4 with the edge ripped off so the it could sit flush against the 1×3.
  • I used scrap 1×3 at each corner to help support the shelves. I found that too much weight was being carried by the screws, so this should move a lot of the work of holding weight from the shelves to the legs.
  • I added a stabilizer to the top.
Mental Note: Add Category

Austin Shake/Malt Roundup/Rankings

I really like ice cream. But sometimes I’m too lazy to sit there and use a spoon. So when that happens I reach for an ice cream shake. Here are the ones in town I like in most favorite to least:

Recommended:

Big Top – pretty much perfect.

EZ’s – good options. Offers malts too.

Mighty Fine – pretty good

P Terrys – portion seems small but is still a lot of calories. good price. gave me gas last time though… cheap prices mean cheap dairy I guess.

Fuddruckers – It’s been a very long time since I’ve been, but I remember liking it.

Avoid:

Hideout – Oreo shake was blended far beyond what it should have been and lost its consistency

Mighty Cone

Alamo Drafthouse – The most disappointing shake I’ve had because it’s also one of the most expensive. It’s like drinking warm whipped cream.

Mental Note: Add Category

My FireFox about:config

This was first a post about one about:config entry in FireFox I wanted to remember. But now there are several, so for easy reference, I am going to just put all of them into one post.

Fixing Accidental Page Zooms (FireFox + Logitech G9x)

I’ve got the Logitech G9x, and I use it with the “microgear” off so my mouse wheel spins free. Unfortunately, I also use Ctrl+click a lot to open tabs, and my free spinning mousewheel triggers the page zoom when I hit Ctrl. If you accidentally zoom all the time like me, you’d like to disable that key combination. And you can. Just go to about:config and find mousewheel.withcontrolkey.action and change it from 3 to 0
mousewheel.withcontrolkey.action = 0

Keeping New Tab Jumpstart from stealing focus

One of the “features” of New Tab JumpStart 0.5a5.4 turns out to be a major annoyance. It steals the focus from your location bar to its own tiny non-awesome bar. You can fix it with:
mlalevic.jumpstart.focus_on_search = false

Make New Tab Jumpstart the default new tab page

browser.newtab.url = chrome://jumpstart/content/tabView.xul

Mental Note: Add Category

A simple htaccess line for microsites

If you’re running a simple site, you may find that using even one sub-directory is overkill. You have one CSS, one JS, and one HTML for the entire site, and name them after your project. If you’re like me, and end up working on multiple sites at a time, it helps if the file names are simple and named after the project. Where that fails is your main “index.html”. I’ve played with redirecting to a project.html file, or having a splash page index.html that redirected. But my solution-de-jour is adding a line to my .htaccess file:

DirectoryIndex my_awesome_project.html

which tells apache to serve my project html when looking for an index file. This is basically a very specific redirect, but you don’t have to serve any possibly sketchy 301 or 302 redirects.

Now I don’t have to guess which of the four “index.html” files I’m working on go to what.