BASH QUICK TIP - SUBSHELLS

When you’re in a shell, and you want to do 1 or 2 commands in another brand new shell, but don’t feel like opening a new window, try using a subshell. Here’s an example: ~ jhaddad$ pwd /Users/jhaddad ~ jhaddad$ ( cd /tmp/; touch bacon.txt ) ~ jhaddad$ pwd /Users/jhaddad ~ jhaddad$ ls -lah /tmp/bacon.txt -rw-r–r– 1 jhaddad wheel 0B Apr 15 13:09 /tmp/bacon.txt Why I like it: I can very quickly fire off a command that involves changing directories without having to switch back to my pwd.

SSH REVERSE TUNNEL TO ACCESS BOX BEHIND FIREWALL

I frequently need to get access to a machine behind a firewall to do some web development, but I don’t have a VPN available. Not a problem - just use a reverse SSH tunnel. By the end of this tutorial, we’ll be able to SSH to the remote server, as well as view any web pages that server has access to. We’re going to connect to the remote server using our local port 5000 - here’s how.

TEXTMATE - STOP ._ BACKUP FILES

Pretty sure this stops TextMate from creating the ridiculous backup files in my network shares. defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1

CANCEL MY GOOGLE!

I can’t believe this stuff exists… I love the internet. hello i am 82 years old and google is on my computer withour permission IT IS UNCONSTITUTIONAL. my compoter is slow now and i want to contact the internet what is the number? Original awesome post

RUNNING PUPPET MASTER ON MAC OS X SNOW LEOPARD

_As of a few hours after this post, I’ve given up trying to get Puppet Master running on Snow Leopard. There appears to be an issue with the SSL certificates generated that’s preventing puppetd from getting it’s recipes. There doesn’t appear to be any way to disable this. I have switched to a CentOS VM, which worked perfectly the first time. The Unixy underpinnings of my Mac seem to be getting less and less useful every day.

'DEAR PRICELINE: SERIOUSLY, WTF?'

Dear Priceline, You really can’t do better than $680 for a flight from LAX to Vegas? Seriously, why is this the #1 listing? For those of you who aren’t aware, it’s a 1 hour flight that normally costs $60 each way. Southwest (cropped out middle prices for simplicity) Lame.

THE LACK OF FLEXIBILITY OF STORED PROCEDURES IN MYSQL

Over three years ago I wrote about how you cannot use a stored procedure in a subquery. Well, it’s 2010, and I’m still annoyed by this and a handful of other things. I was just working today on a report consisting of a series of queries, taking about a minute to generate. Some of the data would be created in a temporary table and queried against multiple times for performance reasons, and ultimately spit out into a CSV file for someone to examine later.

'REDHAT/CENTOS: CONTROL APACHE STARTUP WITH CHKCONFIG'

Copy apachectl (or symlink it) to /etc/init.d/httpd, and add these two lines at the end of the comment section: chkconfig: 2345 64 36 description: script for starting and stopping httpd chkconfig –add httpd These commands will now work: service httpd start service httpd stop Additionally, apache will start when the system boots. You can accomplish this by using rc.local too, if you prefer, but I think it’s more convenient to have everything be service based where you can use chkconfig to manage startup / shutdown.

'LINUX/OSX: FIND OUT WHAT NETWORK PORTS ARE IN USE'

To get a quick idea of what ports you have open on your local box, you can use nmap. ~ jhaddad$ nmap localhost Starting Nmap 5.00 ( http://nmap.org ) at 2010-01-05 11:06 PST Interesting ports on localhost (127.0.0.1): Not shown: 499 closed ports, 492 filtered ports PORT STATE SERVICE 80/tcp open http 88/tcp open kerberos-sec 548/tcp open afp 631/tcp open ipp 3306/tcp open mysql 3325/tcp open unknown 5900/tcp open vnc 9000/tcp open cslistener 10000/tcp open snet-sensor-mgmt

MACBOOK AIR BATTERY DRAIN WHILE SLEEPING

I bought a MacBook Air in June this year, refurbished. I didn’t really use it a lot for day to day work, and when I didn’t use it I was charging it. It was very convenient - it weighs practically nothing and has almost no impact on me while traveling. When I cut back on using it, I noticed a few things. When I’d leave it unplugged for a few days, the battery would be dead.