A A

Tag Archive | "scripting"

Small Vim Shortcut for PHP Tags

Wednesday, September 30, 2009

0 Comments

The short tags in PHP have been deprecated as of 5.3.0. Short tags provided a shorter alternative to the annoying-to-type <?php and <?php echo. Instead, you could use <? and <?= respectively. This was great but it caused problems when working with XML files, and the short_tags option was disabled in the PHP config by [...]

Bash Tips for Power Users

Wednesday, June 10, 2009

2 Comments

Every Geek site needs an obligatory Bash Tips post Copy Files Securely Between Two Machines I used to always forget the syntax for this, until I realized that the syntax is exactly like the standard cp command. In fact, you can copy files like you normally would using scp, on your local machine. The following are equivalent: $ [...]

Calculate Your GPA Using this Bash Script

Thursday, May 21, 2009

0 Comments

This Bash script is used to calculate your Grade Point Average (GPA) on the command line. Usage might not be intuitive. Please see the usage function or just run the script without passing it any arguments. The gval function should be edited to reflect your own region or university. It has been written and tested on [...]

Bash Script to Force an Empty Git Push

Wednesday, April 1, 2009

0 Comments

Sometimes, like when you’re testing hooks or trying to create synced remote and local repos, you’ll find yourself touching empty files just to get a git push going. This script automates this task by creating a unique temporary file, committing it, pushing, and then removing the file. #!/bin/sh TMP=tmp-`date +'%m%s'` touch $TMP git add $TMP git commit $TMP -m '(forced [...]

How to Maintain Static Sites with Git & Jekyll

Tuesday, March 31, 2009

4 Comments

Static sites in this context just means non-database driven sites. Your static site can be an elaborate PHP script or just a few markup and image files. For this I am using Jekyll – A neat Ruby gem that makes your static sites dynamic. It lets you create layouts and embed custom variables in your [...]

Script to Quickly Setup WebApp Environment and Domain

Saturday, October 11, 2008

0 Comments

Just sharing a script I wrote to quickly deploy Wordpress (and eventually a few other webapps) sites, which somebody might find useful. This uses Linode’s API* to add the domain name to the DNS server along with some subdomains. If you’re using another server, (Slicehost, your own, etc), you can alter the dns class to [...]

How to POST Form Data Using Ruby

Thursday, April 24, 2008

2 Comments

POSTing data on web forms is essential for writing tools and services that interact with resources already available on the web. You can grab information from your Gmail account, add a new thread to a forum from your own app, etc. The following is a brief example on how this can be done in Ruby [...]