Perforce can temporarily checkins of changes that you might want to share with others before fully commiting them to the …
read moreOther articles
"Command line bulk file rename"
To prepend to to filenames
cd to_folder ls | xargs -I {} mv {} addthis-{}or target jpgs
read morecd to_folder ls *.jpg | xargs …"Shell redirection"
To redirect stdout and stderr in bash we use:
./ShellFile.sh &> test.logHowever in tcsh that results in:
read moreInvalid …"Thor Adding --verbose"
With a command line Ruby application using Thor for the option parsing I want to be able to run:
read more$ thor_app …"Fixing Mangled Octopress Tags"
When creating my blog I have been inconsistent with the tag
read morecommand line,Command lineandCommand Linethe case …"Thor Variable Arguments"
"Screen Scrollback"
Enter copy mode
ctrl-a [Use cursors of vim motions to move to relevant area.
Space to start selection, space again …
read more"Bash String Manipulation"
Removal of substring:
string="test string" echo $string remove="test" short_string=${string#$remove} echo short_stringNote that inside the
read more${}string …"Revert in Git"
and Remove Orphaned Commits.
I use
read moregitxgraphical tool on OS X to find the SHAs for commits. Revert back …"Edit Octopress Posts"
Creating new posts in Octopress is
rake new_post["Edit Posts"]which outputs the created filename.Posts are prefixed with date …
read more"Reverting in git"
I use to use
read moresvn revertto roll back local modification and get back to the state I was in …"Cshrc alias loop"
Here are some aliased commands which stop line wrapping on really long lines, making the output much more readable:
read more# Stop …"set vs setenv"
setenv allows sub shells to inherit the value.
Set
read moreset x = "twenty" echo $x > twenty ## New Shell csh echo $x …"For loops in csh/tcsh"
"Find RedHat Version"
cat /etc/redhat-releaseReturns some thing like:
Red Hat Enterprise Linux Client release 5.7 (Tikanga)Find Kernel version using …
read more"tcsh check a var exists"
To check if an environment variable exists in .mycshrc or shell scripts
read moreif ($?TERM) then echo "TERM is $TERM" endif …"Terminal Colours"
I have decided to clean up my vim colorschemes. I have been using ir_black for sometime but it does not …
read more"Add about page to Octopress"
To add static about page to octopress blog, assuming that octopress has been already setup:
Create the page from the …
read more"Push local folder to remote server over ssh"
After struggling to get the rake task for octopress to deploy I decided to fall back to the command line …
read more"Ubuntu (Linux) List Disks"
sudo lshw -class disk -class storage -shortOutputs :
read moreH/W path Device Class Description ===================================================== /0/100/1c.3/0 …"OS X Screen Capture"
To capture the screen on OS X :
⇧⌘4 : Selected area to capture.
⇧⌘4-space : Capture a window.These are defined in …
read more"Git Submodules"
For code reuse within I have found Subversion externals really nice to work with. Instead of copy and pasting code …
read more"Syncing Safari via dropbox for pre iCloud OS X"
THIS NO LONGER WORKS, IF IT EVER DID :(
When you add a link to safari, it replaces the link to …
read more"OS X Installing R"
"Mountain Lion Setup, Part 3 : Little Snitch & Dotfiles"
Little Snitch
There is currently a preview (Beta) of [Little Snitch 3][littelsnitch3]. If you have not come across Little …
read more"Mountain Lion Setup, Part 2 Homebrew & RVM"
Following on from Macbook Pro Setup, Now it is time to install some of the command line tools.
I have …
read more"Mountain Lion default $PATH"
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/binTo Reset it back to this value run (from /Applications/Utilities …
read more"Lion default $PATH"
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/binTo Reset it back to this value run …
read more"Mac Mountain Lion Compatibility"
One of the limitations of mountain lion is that they are only going to support 64 bit Kernel extensions, the …
read more"Vim Terminal Colours"
"Using Github behind a restrictive firewall"
When working behind a restrictive firewall, which limits ssh connections you may be running into some of the following errors …
read more"Ubuntu, formatting a 3TB drive"
I started off following the ubuntu guide for installing a new drive, which uses fdsik to create the partitions how …
read more"Update your RVM Ruby and migrate gemsets"
Update RVM
$ rvm get headList current versions, and all versions
$ rvm list $ rvm list knownSelect the version you …
read more"Bash script get current script directory"
Sometime a script needs to now the directory that it is executing from, the best solution for this is:
read moreDIR …"Trying to disable Caps Lock on Unix systems"
Entering the following command in to your .bashrc seems like a simple way forward.
xmodmap -e "remove lock = Caps_Lock"However …
read more"What shell am i using?"
If you are working on a new system or with multiple environments it is good to know what type of …
read more"SVN multi-line comments on the command line "
Answer:
svn commit -m $'Line 1 \nLine 2'The Problem
Committing to subversion on the command line and using escaped …
read more"unix mail command, delete all messages"
Cron jobs can have there results returned as mail via the unix mail system. If left unchecked for a while …
read more"list_temp_files script"
A simple script for finding temp files from the current directory and below. I often run this before adding a …
read more"irb as a Megapixels calculator"
I have just added the method below to my ruby .irbrc file for quickly calculating image megapixels. from OS X …
read more"Recursive grep, with filtering"
I noticed today that greps recursive function is different to finds recursion.
find ./ -name *.txt grep -R 'text' *.textThe …
read more"Suppressing Warnings in Ruby Scripts"
Suppressing warnings is usually a bad idea but if you understand the risk and want to carry on regardless. When …
read more"Tagging a git repo and pushing tag to github"
This assumes that
originis the label for github.
Tagging a github repo for my gem releases I do:read more$ git …"Ruby Search and Replace Script."
A small standalone script that search through a file doing text substitutions.
read more1 2 3 4 5 6 7 8 …
"warning: already initialized constant"
Do you some times see:
read moreFileUtils.rb:93: warning: already initialized constant OPT_TABLE FileUtils.rb:1176: warning: already initialized constant …"Make Ubuntu Samba share show up on OS X 10.6 finder"
Install Avahi, it like bonjour auto discovery but for linux, then tell it about your servers samba service.
read more$ sudo apt-get …"Get latest Ruby 1.9.2 build with RVM"
"Using ~/.ssh/config and no passowrds with Mac OS X"
Using ssh to securely connect with servers from the terminal is pretty easy. set up a public key and a …
read more"Obnoxious gem warnings"
recenlty after updating rubygems Istarted getting a lot of warning like this when running ruby or executable gems:
NOTE: Gem …
read more"bash scripts and cron"
I have not fully read it but it looks like this is a good guide to bash scripting. A few …
read more"'unregistered torrent' flush the DNS"
If a torrent application has been running and torrents start showing a status of 'unregistered torrent' a likely cause is …
read more"Ruby CLI user input using gets"
Using a while true loop with 'gets' and a case statement, can create a compact command line interface for ruby …
read more"gem permissions on WebFaction"
After making a few updates to my site I decided to upgrade the version of sinatra I was using in …
read more"My Backup Strategy"
Considering various raid strategies I decided that Raid 5 would be too limiting and have previously found raid striping systems …
read more"screen -x not connecting when running as an other user"
I have been running into issues with screen when switching to another user:
read more$ su otheruser > password $ screen -x > Cannot open …"Tagging a git repo for a Release "
I think it is good practise to create a read only tag when releasing an application. This allows you to …
read more"Fixing Ncursers on OS X 10.6.3+"
Currently OS X 10.6.3 - 10.6.5 the ncursers library is broken. A hacky fix is to copy …
read more"Mac OS X libSystem cache out of sync"
For various reasons Mac OS X (at least 10.6) can get the system cache out of sync with the …
read more"Sinatra Heroku and config.ru"
Rack applications often require a config.ru for deployment. The standard config.ru for classic sinatra applications is well documented …
read more"OS X open finder from command line"
"Stop/Start and Restart Samba on OS X"
To Stop Start and Restart Samba on Mac OS X 10.6:
read moresudo /usr/sbin/smbd stop sudo /usr/sbin …"Mac OS X Default Path"
As this seemed to be a useful post on my old blog I am reposting it. Just in case the …
read more"Error: NoMethodError: undefined method `compact' for nil:NilClass"
When running a sequel migration I kept getting this error:
Error: NoMethodError: undefined method `compact' for nil:NilClassMy setup …
read more"Basic grep usage"
Grep is a unix (and mac os x) command line tool to search files for text.
read more
1) Search for all …"Removing Ports OS X"
"Benchmark your website for load times."
I have been wondering how to do this for a while and accidentally discovered it while perusing this heroku page …
read more"Turn a .jar file into a mac .app"
Following this article lets you turn a executable java .jar into a mac appliction (.app). The Tools are only available …
read more"Adding USB drives to a headless Ubuntu Linux box"
After adding some USB2 (NTFS formatted) drives to a headless Ubuntu server, they were not auto-mounted so I had to …
read more"Installing git on a clean build of OS X"
"Homebrew package management for Mac OS X"
Homebrew is a new package management system for Mac OS X. A good review/tutorial on EngineYard.
Update 20-August-2010
read more
Then …