2009-06-02

2009-06-02 12:48 am

Beautiful people often behave like flakes and assholes because they suffer few consequences. If you piss someone off, who cares? Some new mook will be along soon enough. But what happens when their beauty fades?

I guess I’ll find out soon enough.

Original: craschworks - comments

The basics:

Rent: $900/month, due on the 1st of the month

Deposit: $1800 (last+security deposit) due upon move-in.

Utilities: I don't know what they'll be yet, but whatever they are, we'll split them equally

Availability: July 1, 2009

Amenities: PG&E, water, garbage, wireless internet, 17 ft. ceilings, 10 ft. rollup door, 110 & 220 amp power, 300 ft2 office and mezzanine, and 1500 ft2 warehouse

Location: near 237 & 85 exit, 1 mile from Mountain View Caltrain
Nearby amenities: Goldstar Academy gymnastics (offers adult classes), HackerDojo, 5 minutes from downtown Mountain View

About Me: 36 year old single, male programmer/photographer

The space: your half of the office (150 ft2) and warehouse (750 ft2)

Parking: 1 dedicated parking space

Detailed description:

Are you an artist, photographer, or Maker? Do you want large open spaces with high ceilings for your projects?

If so, perhaps you'd like to share my 1800 ft2 warehouse/studio with me. The space is empty right now, but I plan to outfit it as a photography/videography studio. There's a 300 ft2 office in the front, and 1500 ft2 warehouse in the back. The place comes with a shower and bathroom, but no kitchen. I plan to install a rolling kitchen, as well as a washer dryer.

Eventually, I expect to host classes of various kinds (such as product photography, airbrush makeup, costuming, the business of photography), and host "art parties".

The space is close to the highway 237 & 85 intersection, and the Mountain View Caltrain is about 1 mile away. There is a 12 foot roll-up door, a skylight, and a mezzanine over the office. Conduit and outlets are placed at regular intervals throughout the warehouse, and 110 and 220 amp service is available. The warehouse is heated, but there is no air conditioning. The paint and carpet are pretty battered right now, so if you need pristine looking walls immediately this is not the place for you. (I do plan to paint and replace the carpet, but it won't happen immediately.)

The space will be available on July 1. Ideally, I'd like to be able to find someone to share half the space. Rent would be proportionate to the amount of space you use. Move in would be first+last+security deposit. For example, if you rented half, it would be $900+$900+$900, or $2700 total to move in. Rent would be month-to-month, though if you'd like to be on the lease, something could be arranged.

I work a day job, so this would be ideal for someone who could use the space during the day. If you're interested, let me know! If not, please feel free to forward to anyone you think would be interested.

About me: 36 years old, single, male, Stanford grad. I'm into photography, Burning Man, seasteading, among many other things. During the day, I work as a programmer for a mutual fund.

Feel free to give me a call if you're interested: (650) 773 6419.

Chris

P.S.

It's located a few doors down from the likely location of the Hacker Dojo:

http://hackerdojo.pbworks.com/

"A place with plenty of parking, easily accessible by those all the way up and down the peninsula, where we can't easily offend neighbors with sound and can have many more come together in community and solidarity than would be possible in a living arrangement. Spiritual cousins include The Crucible in Oakland, Cellspace, noisebridge, and Hat Factory in San Francisco, and Bucketworks in Milwaukee, WI - all community centers dedicated to their own forms of creation and craftsmanship, and TechShop for the more hardware oriented in Menlo Park. We'd like to offer this kind of community for computer-oriented folks in the mid-Peninsula. You don't need to be a programmer to use/enjoy this space."

They've raised most of the money for a lease, and barring some unforeseen circumstance, will sign this month. If they do, there will be a 4400 ft2 meeting, event, and project center nearby:

http://www.jvlewis.com/for_lease_140a.html

There is also a machinist and a woodworker (high end furniture) in the same complex.

Original: craschworks - comments

This post is for small snippets of code that don’t warrant a post of their own.

Use imagemagick’s convert command to reduce an image to 640×427

convert -geometry 640x427 -quality 75 _MG_9954.thumb.jpg _MG_9954.reduced.thumb.jpg

Copy a file located on a remote machine (target) to the local directory (.) via an ssh tunnel through a firewall machine (firewall).

By default, rsync will delete any partially transferred file if the transfer is interrupted. Using the –partial option tells rsync to keep the partial file which shouldmake a subsequent transfer of the rest of the file much faster.

The –append option causes rsync to update a file by appending data onto the end of the file, which presumes that the data that already exists on the receiving side is identical with the start of the file on the sending side. Note that the append option isn’t present in rsync v2.6.3 and below.

rsync -av –partial –append -e “ssh firewall ssh” user@target:/Users/crasch/file .

Find any files in the current directory and below which have 2009050 in the filename, and save them as a gzipped tar file in the /Users/crasch home directory:

sudo find . -type f -name ‘*2009050*’ -print | xargs tar -zcvf /Users/crasch/`date ‘+%d%m%Y_archive4.tgz’`

cat /etc/resolv.conf will display the IP addresses of nameservers available to a host.

To execute a sql query save in a file named [name].sql from within sql92 (the FrontBase command line):

script ‘[name].sql’;

To set the title of a terminal to the name of the file being edited in vim, add the following to your .vimrc:

set titlestring=%t%(\ %M%)\ \ \ \ %{hostname()}

if &term == “screen”
set t_ts=^[k
set t_fs=^[\
set titlestring=%t
endif

if &term == “screen” || &term == “xterm” || &term == “xterm-color”
set title
endif

To set the name of the terminal to the name of your current directory, add the following to your .bashrc file:

case $TERM in
xterm*|rxvt*)
PROMPT_COMMAND=’echo -ne “\033]0;[`basename ${PWD}`]\007″‘
;;
screen*)
PROMPT_COMMAND=’echo -ne “\033k\033\134\033k[`basename ${PWD}`]\033\134″‘
;;
*)
;;
esac


Search and replace in vim:

File contains:

abcabc
abcabc
abcabc

Assuming cursor is at that beginning of the first line:

:s/a/X/ - “replace first a on the current line”:

Xbcabc
abcabc
abcabc

:s/a/X/g - “replace all a’s on the current line”:

XbcXbc
abcabc
abcabc

:2,$s/a/X/ - “from line 2 to end replace all first found a’s on line”:

abcabc
Xbcabc
Xbcabc

:2 s/a/X/ - “replace first A on line 2″

How to change the default shell from tcsh to bash on Mac OS X:

niutil -createprop . /users/crasch shell /bin/bash

abcabc
Xbcabc
abcabc

Line ranges are:
only on line where cursor is on.
5,15 => line 5 up to and including line 15
2,$ => line 2 to end
.,$ => from line where cursor is on to end.
% => whole file; short for 1,$ (or 0,$ if you like)

Display non-printing characters

:set list

Set tabstop to 8:

:set ts=8

Search for tabs:

/\t

When key is pressed, insert a series of spaces:

set expandtab

Setting ‘expandtab’ does not affect any existing tabs. In other words, any
tabs in the document remain tabs. To convert existing ’s to spaces:

:set expandtab
:%retab

Now Vim will have changed all indents to use spaces instead of tabs. However,
all tabs that come after a non-blank character are kept. If you want these to
be converted as well, add a !:

:%retab!

This is a little bit dangerous, because it can also change tabs inside a
string. To check if these exist, you could use this:

/”[^”\t]*\t[^”]*”

It’s recommended not to use hard tabs inside a string. Replace them with
“\t” to avoid trouble.

The other way around works just as well:

:set noexpandtab
:%retab!

Format the output of a FrontBase sql query:

set format ‘%#,%0c,%1c,%2c,%3c’;

Perl recursive, in-place search and replace:

find /path/to/start/from/ -type f | xargs perl -pi -e ’s/applicationX/applicationY/g’

How to pass the debug flag to xcodebuild:

xcodebuild -project testtool.xcodeproj clean && xcodebuild -project testtool.xcodeproj ‘OTHER_CPLUSPLUSFLAGS=-g’

How to start up gdb with a program that takes command line arguments:

gdb –args /Marketocracy/bin/testtool actionsFromDateToDate -key 51E82C2B3976FB66C0A801E0 -start 2001-01-01 -end 2009-06-22

How to execute an Objective-C command in GDB:

p [_outputField setStringValue:@”123456”]

How to set a breakpoint on a method that takes two arguments:

b –[NSArray removeObject:atIndex:]

Often, you will want to switch from one directory to another and back again. To make it easier to switch and return, use a directory stock.

To push a directory onto the stack, type:

pushd ~/Projects/trunk/lib/ruby/

To display the directories in the directory stack:

dirs -v

…which should display all of the directories in the directory stack:

$ dirs -v
0 ~/Projects/trunk/lib/ruby/Marketocracy
1 ~/Projects/trunk/Scripts/build/stock-data

To swap the top two directories (directory 0 with directory 1), type pushd with no arguments.

To switch to a numbered directory, type pushd +[NUMBER]. For example, to switch to the directory #1 (~/Projects/trunk/Scripts/build/stock-data), type pushd +1.

To remove a directory from the stack

——–

Via neeraj:

Where is ruby installed on my machine?

irb can help you.
view sourceprint?
1.> irb -rrbconfig
2.>> Config::CONFIG[”bindir”]
3.=> “/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin”

A much easier way is:

> gem env
02.RubyGems Environment:
03. - RUBYGEMS VERSION: 1.3.1
04. - RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
05. - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
06. - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
07. - EXECUTABLE DIRECTORY: /usr/bin
08. - RUBYGEMS PLATFORMS:
09. - ruby
10. - universal-darwin-9
11. - GEM PATHS:
12. - /Library/Ruby/Gems/1.8
13. - /Users/nkumar/.gem/ruby/1.8
14. - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
15. - GEM CONFIGURATION:
16. - :update_sources => true
17. - :verbose => true
18. - :benchmark => false
19. - :backtrace => false
20. - :bulk_threshold => 1000
21. - :sources => [”http://gems.rubyforge.org/”, “http://gems.github.com”, “http://gems.github.com”]
22. - REMOTE SOURCES:
23. - http://gems.rubyforge.org/
24. - http://gems.github.com
25. - http://gems.github.com

If you are interested in finding where a particular gem is installed then run following command. It lists the location of the gem also.

> gem list -d rails
02.
03.*** LOCAL GEMS ***
04.
05.rails (2.2.2, 2.2.1, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 2.0.1, 1.2.6, 1.2.5)
06. Author: David Heinemeier Hansson
07. Rubyforge: http://rubyforge.org/projects/rails
08. Homepage: http://www.rubyonrails.org
09. Installed at (2.2.2): /Library/Ruby/Gems/1.8
10. (2.2.1): /Library/Ruby/Gems/1.8
11. (2.1.2): /Library/Ruby/Gems/1.8
12. (2.1.1): /Library/Ruby/Gems/1.8
13. (2.1.0): /Library/Ruby/Gems/1.8
14. (2.0.2): /Library/Ruby/Gems/1.8
15. (2.0.1): /Library/Ruby/Gems/1.8
16. (1.2.6): /Library/Ruby/Gems/1.8
17. (1.2.5): /Library/Ruby/Gems/1.8

http://evaluation.nbu.bg/amitko/Library/O%27Reilly%2077%20Books/unix3/mac/ch01_05.htm

Mac OS X’s default shell, tcsh, lets you move your cursor around in the command line, editing the line as you type. There are two main modes for editing the command line, based on the two most commonly used text editors, Emacs and vi. Emacs mode is the default; you can switch between the modes with the following commands:

bindkey -e Select Emacs bindings
bindkey -v Select vi bindings

The main difference between the Emacs and vi bindings is that the Emacs bindings are modeless (i.e., they always work). With the vi bindings, you must switch between insert and command modes; different commands are useful in each mode. Additionally:

* Emacs mode is simpler; vi mode allows finer control.
* Emacs mode allows you to yank cut text and set a mark; vi mode does not.
* The command-history-searching capabilities of the two modes differ.