Entries Tagged as 'programming'

Monday, April 11th, 2011

Shell-sort with Hungarian (Székely) folk dance

via youtube.com Via Winnie Cassiopeia.

Monday, February 9th, 2009

GEEK: prune directories, files from find output

Sometimes you want to exclude a directory and/or files from a search. This alias: cfind=’find . \( -type d -name .svn -prune -o -path ./stock-data/tests/data -prune \) -o \( -type f \! -name “*.csv” -print0 \) | xargs -0 grep’ …means: “Recursively loop through all of the files and directories in the current directory and [...]

Monday, February 9th, 2009

GEEK: user admin cheat sheet

How to set various user properties via the command line on Mac OS X

Monday, February 9th, 2009

GEEK: Display method descriptions for all the methods in a Python module

Type the following in the python interpreter: help() modules [name of module] You should see a list of the methods in the module with their descriptions.

Friday, January 30th, 2009

GEEK: How to tell where your script is located in Python

Suppose you’re executing a python script in the debugger, and you want to find out where the script you’re executing is located. This should do the trick: import os os.path.dirname( os.path.realpath( __file__ ) )

Tuesday, July 22nd, 2008

GEEK: how to add a user to the admin group on Mac OS X

Here’s how to add a user to the admin group using dscl: dscl . append /Groups/admin GroupMembership crasch Remove a user: dscl . delete /Groups/admin GroupMembership crasch Reading the membership of the admin group: dscl . read /Groups/admin GroupMembership

Wednesday, July 16th, 2008

GEEK: Running a ruby script via crontab

So, I’m trying to set up a ruby script that screenscrapes another website, writes the results to a local file, then rsyncs the file to another machine behind a firewall. This post details the problems I ran into while trying to get cron to run the ruby script and rsync to the remote host.

Wednesday, December 12th, 2007

GEEK: shell script question

Suppose you want pass in a complex query to a command line sql interpreter from within a shell script. You can do so with a command like this: sql92

Wednesday, December 12th, 2007

GEEK: editing groups, using sudo

Tuesday, November 27th, 2007

GEEK: Notes on rubygem, pdb.set_trace()

If you want to use a newly installed rubygems, and you don’t want to require ‘rubygems’ for every program that uses a gem, you need to set the RUBYOPT environment variable. For example, if you’re using tcsh, you should put the following in your .tcshrc file: setenv RUBYOPT rubygems This will cause the rubygems module [...]