Search my site
Twitter
Flickr
Archives

Blog Posts

Friday
Oct212011

Handy GIT Tip: Prevent local changes from being commited and pushed

Here are a couple of quick tips for dealing with ignoring files in GIT. It has saved me a lot of headaches so I am documenting them here for posterity's sake.

If the file is not yet tracked by GIT:

You can easily ignore files if they have not been previously added to the GIT repository by adding it to the .git/info/exclude file. This is extremely useful when you want to exclude text editor specific files, windows thumbnail files but do not want to include it in the main repository .gitignore file.

# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
*.[oa]
*~
*.tmproj

If the file is already being tracked:

This method is useful for when you need to maintain local changes to a file but do not want to accidentally push those changes to the main GIT Repository.

mb2:~ mark$ git update-index --assume-unchanged loc/of/file
Sunday
Oct092011

Zombie Pub Crawl VII

Tourist Zombies Just got finished with the 7th annual Zombie Pub Crawl in Minneapolis MN. The event just keeps getting larger. Now with two cities to visit and food carts in the streets. I was able to capture some great shots with my new Nikon 35mm f/1.8G AF-S DX. I'll let the pictures speak to how great the event was.

Saturday
Aug062011

Just Married!

First dance photo.I just got married to my lovely wife Stephanie! We had a wonderful ceremony and a great time in Tulum Mexico for the honeymoon (honeymoon pictures).

For the wedding I built a photo booth using custom software, a small nettop computer, and an arduino to control the lighting and initiate picture taking.  I plan on making a few posts on how it was built.  But the results were great with lots of fun candid shots.

Click to see all photo booth pictures on Flickr!

Friday
Jan142011

Install FlexGet on MacOS X

I love automation. Especially when it comes to torrents. It turns out my favorite FlexGet torrent downloader is not as easy to install on Mac as Ubuntu. I will fix that by an easy to follow install guide.

FlexGet is a python based script that parses RSS feeds for torrents and downloads them to a directory. It automates torrent downloading when used in conjunction with a torrent application that supports watch directories such as Transmission or my favorite command line application rTorrent.

Install XCode

Put your MacOS X install disk and run the xcode.mpkg from the optional install folder.

Install MacPorts

Download the package from the MacPorts site and install the mpkg file.

Install Python (optional)

Depending on the state of your system you may need to install or update python.

sudo port install python

Install wget (optional)

sudo port install wget

Install the Python dependencies for FlexGet

sudo easy_install FeedParser && sudo easy_install SQLAlchemy && sudo easy_install PyYAML 
sudo easy_install BeautifulSoup && sudo easy_install html5lib && sudo easy_install pynzb
sudo easy_install progressbar && sudo easy_install flask && sudo easy_install cherrypy

Install FlexGet from source

We need to download the latest source to a directory and run the python setup.py with sudo privileges. The following is the latest source from the flexget website. In the end you should have a flexget binary to

/usr/local/bin/flexget

cd ~/Downloads
wget http://download.flexget.com/unstable/FlexGet-1.0r1862.tar.gz
tar xzf FlexGet-1.0r1862.tar.gz
cd FlexGet-1.0r1862
sudo python setup.py install

Configure FlexGet

Create a directory ~/.flexget and a config.yml

mkdir ~/.flexget
cd ~/.flexget
touch config.yml

Edit the file to contain the contents where RSS_URL and WATCH_DIR_LOCATION. For more configuration options check out the configuration page.

#feeds:
#  my_feed:
#    rss: http://example.com/rss.xml
#    patterns:
#      - something.rexexp
#    download: ~/downloads/

feeds:
  tv-shows:
    regexp:
      accept:
        - torrent
    rss: RSS_URL
    download: WATCH_DIR_LOCATION

Test out flexget. It should download the torrents from your specified

/usr/local/bin/flexget

Configure Cron: Now lets make it automatic!

Open your crontab. This may require some vi editing. Check out this vi tutorial.

crontab -e

The following will run flexget every 30 mins (as your current user).

*/30 * * * * /usr/local/bin/flexget --cron

Congrats! Everything should be working. Check console output if you are still having trouble. Often you will get a hint for a missing dependency when installing python packages. If flexget seems to install correctly check your configuration file.

Sunday
Nov282010

Fix Command Line Mistakes With Carat (^) Symbol Substitution

Open the Tip Jar Creative Commons License photo credit: usnationalarchives

Its time to open the tip jar again. The command line is incredibly powerful but requires perfect typing of commands and paths. I did not know how to fix a command until I read the lifehacker article. It seems every time I consider myself an expert I see a simple tip that *quashes* my ego back to novice status.

The Carat (^) symbol in many terminal or command shell environments is a simple text substitution command. It follows an idea of '^stringtorelpace^replacementstring'. This is great for fixing errors or substituting commands.

Fix a typo

mb2:~ mark$ la -lh /usr/local/nagios/etc/nagios.cfg
-bash: la: command not found
mb2:~ mark$ ^la^ls

This corrects the mistyped 'ls' command.

Change a command

Another interesting use is to change the command used. For example you may want to first list 'ls' the file to see if it exists, and if not, create it with 'nano'.

mb2:~ mark$ ls /usr/local/nagios/etc/nagios.cfg
ls: /usr/local/nagios/etc/nagios.cfg: No such file or directory
mb2:~ mark$ ^ls^nano

There are many time saving tricks that can be used with this simple command. Check out the source articles for more information.