Thursday, May 26, 2016

Wednesday, April 22, 2015

Friday, April 17, 2015

Installing RPostgreSQL for R on Max OS Yosemite

I went through a painful period of digesting wrong answers to this question on Google. In fact most of the answers are just of the type "this is somebody else's problem so we can't help"

Anyway this is the eventual sequence of steps I found to install this that works:

brew install postgresql
svn checkout http://rpostgresql.googlecode.com/svn/trunk/ rpostgresql-read-only
cd rpostgresql-read-only
R CMD INSTALL --preclean RPostgreSQL

then in R just type library('RPostgreSQL') and you're good to go





Sunday, June 29, 2014

Easy find


I found myself typing find . -name "*.java" | xargs -iHn "something"  so often I decided to make it into a bash script and put it in a new ~/Dropbox/bin folder so that I never have to do it again. Worse I never use the print0 option which let's you search files that have spaces in the filename, as it's too hard to remember. So, here's the script.



Monday, May 26, 2014

Sending notifications from Emacs (Mac OS X)


Sending notifications from emacs is something I find useful. In an earlier blog post I talked about how to use Growl to do so. http://justinsboringpage.blogspot.com/2009/09/making-emacs-growl.html

Well now you don't need Growl any longer. There's a neat github project called terminal notifier https://github.com/alloy/terminal-notifier which let's you send notifications from the terminal.

You can install it simply, via Homebrew or Rubygems as follows:
$ [sudo] gem install terminal-notifier
OR
brew install terminal-notifier
Then you can send notifications using a command like this:

terminal-notifier -message "hello"

Finally in order to send the notification from emacs we need to write a little Emacs lisp.

Check out this gist for the code I use:

https://gist.github.com/justinhj/eb2d354d06631076566f#file-gistfile1-el

This lets you send a notification in the future using M-x timed-notification

You are prompted for a time, and the format of that time can be given in a human readable way such as "2 seconds" or "5 minutes" (If you're curious for the allowed options look at the info page in emacs for the function timer-duration )

Then you are prompted for the message "Go to the store", and the message will be sent.

The code is very simple, it simply uses run-at-time to run the terminal command in the future. A useful command is find-executable, which given a name will find that executable in your path and run it. This makes configuring tools like this less effort.

Troubleshooting

Hey if it doesn't work first time what can you do?


  1. Check if terminal notify is installed correctly by running at terminal
  2. If that succeeds and you don't get a message check if you have enabled do not disturb mode
  3. Otherwise if that succeeds and yet emacs isn't sending messages you likely don't have the executable on the path. M-x customize-variable exec-path








Tuesday, April 1, 2014

Watch

So this is pretty cool.


The watch command (available linux and on Mac via brew) will run a program every n seconds and display the results in a terminal.

For example, the following common will show the display above with human readable disk free space on your system. But since the command can be anything you want this is a pretty powerful tool.

watch -n 3 df -h

Wednesday, March 12, 2014

Checkout out your DB tables

I was doing some DB work today and wanted to be able to sort all DB tables based on the date they were created. Turns out you can do some neat stuff by looking in the information_schema.tables. For example this shows all the InnoDB tables.


select `table_schema`, `table_name`, `create_time`  FROM information_schema.tables where engine = 'InnoDB' order by create_time desc  ;