Monday, May 26, 2014

How to use CapsLock to Left click and more

I wanted to be able to left-click with the keyboard and found that AutoHotKey could help me do that. Here's how to do it:

1. Download and install AutoHotKey
http://download.cnet.com/AutoHotkey/3000-2084_4-10279446.html
2. Run AutoHotkey
3. Modify AutoHotkey.ahk in notepad, adding these two lines. The second line allows you to still use capslock, but it is now mapped to Shift+CapsLock.
Capslock::LButton
+Capslock::Capslock
4. Make other desired changes or removals (see their documentation)
5. Re-run AutoHotkey
6. Make AutoHotkey run every time you start you computer by adding a shortcut to your script to the start menu startup folder, as described in the AutoHotkey FAQ:
AutoHotkey FAQ
You may also want to reference the following for more information.
MouseClick
Remapping Keys and Buttons

 Good luck!

Thursday, May 15, 2014

Edit a file on a Mac (hfs+) partition using a Ubuntu USB stick

  1. download and install the Lubuntu iso onto a USB stick (the dd command works for writing to USB).
  2. Download the hfsplus debian package onto another USB stick.
  3. Boot into lubuntu and install the hfsplus package (sudo dpkg -i <thepackage.deb>)
  4. mount your drive ( mount -t hfsplus -o force,rw /dev/sdXY /media/mntpoint )

Tuesday, April 22, 2014

Simple youtube audio player with VLC

There is a lot of great music posted on YouTube. Before deciding to buy it on amazon, google play, or itunes (are there any other providers of mp3 music these days?), you probably want to play it, but the standard YouTube interface is incredibly ugly, especially when you are just trying to play the music. You can make an ascii text playlist that contains the URL to youtube videos, then fire up vlc like this:
vlc --intf rc -Vdummy <playlist_or_youtube_URL>
type 'help' to see your options. If you want global control over the player, you can set global keyboard shortcuts in Tools.

Monday, September 2, 2013

Google two-step verification with an ipod touch 2g

I recently was given an old ipod touch 2g. Because it can't be updated to iOS 5+, a lot of the new apps don't work for it, including google's new apps. Because I use google's 2-step verification, that meant that putting in my regular google password didn't get me into gmail or calendar. The ipod touch 2g (and most devices, I'm guessing) can be used with google's two-step verification, as it turns out. I've successfully used this approach with Thunderbird as well:

1. Go to your account setting (go to gmail, click your name or picture, click "account")
2. Click "Security"
3. Scroll to the "2-step verification" section
4. Follow "Manage your application specific passwords" link
5. If requested, re-enter your password
6. Follow the directions in the box, "Step 1 of 2: Generate new application-specific password"
6b. (You will put in a name for your device, e.g. ipod touch 2g)
7. Click "Generate password"
8. When you set up your gmail account in the ipod touch 2g (or other device/application), use this application-specific instead of your normal password. (For ipod touch 2g: Setting>Mail, Contacts, Calendars>Add Account...)
9. That's it, good luck!!!

Thursday, September 27, 2012

Update Dell BIOS from linux

NOTE: messing with your BIOS is obviously dangerous.  Proceed at your OWN RISK!
First, install libsmbios-bin
sudo apt-get install libsmbios-bin
Now, you need to get the proper .hdr file.  It is bundled inside those little executables Dell has on their website.  So, start by downloading the latest .exe file from Dell. These can be extracted either with unzip or wine, as shown from this log file.
After trying unzip, I tried this command, and it worked:
wine O780-A13.exe -writehdrfile -nopause
Creating the file: O780-A13.hdr Now, follow these directions (as su or root):
modprobe dell_rbu
dellBiosUpdate -u -f ./O780-A13.hdr
Now just reboot, and wuala, an updated BIOS.

Thursday, August 16, 2012

How to run a ruby script

Windows users:

1. Install ruby

goto http://www.ruby-lang.org/en/downloads/ , then to the Ruby on Windows section and download and install the One-Click Installer.

2. Some scripts can be run simply by clicking on them (this is rare, though).

3. Running scripts from the command prompt

Often scripts want some kind of input or can give useful output. In this case you want to run them from the command line.  See this page on the command prompt in 15 minutes for an overview.
When you have navigated to the directory with the ruby script in it (use the commands cd and dir to get there), you are ready to run your script.  Just type:

ruby myscript.rb

Depending on how windows and ruby has been configured, you may also be able to just type

myscript.rb

Many scripts expect an argument (like a filename) after the script name.  If it does, give it the appropriate argument like this:

myscript.rb filename

Ubuntu/Debian users:

To get it, open a terminal and type:

sudo apt-get install ruby irb ri

Make sure the script is executable:

chmod +x myscript.rb

To run the script:

./myscript.rb

Wednesday, August 15, 2012

How to boot off USB stick ASUS 1201n

This can be a little tricky. Basically, you need to change 2 settings in the BIOS before it will boot off USB. You need to change the boot order and the hard drive order.  [I need to verify the actual names, but I am certain you need to change 2 settings before it will work]

Tuesday, June 12, 2012

Why I'm back to Ubuntu from Linux Mint

Many Ubuntu users were not happy with the decision to use Unity over gnome.  Unity is slick in some ways, but it is (at least originally) very slow and very un-customizable.  A lot of Ubuntu users I know switched to Linux Mint, and I did too.  Now I'm back to Ubuntu 12.03 LTS.

Why did I switch back to Ubuntu?

  • Slower updates and broken repos - Ubuntu updates are slow, but Linux Mint's are even worse.
  • No upgrade option - Linux Mint users aren't really given a simple path to upgrade when new releases come out.  I at least like to try to upgrade one or two editions before doing a fresh install.
  • Better support for Ubuntu - It's easier to search for and get online help for Ubuntu.  There are just enough interfaces (nice, albeit) in Mint that it makes some fixes take longer than they could.
  • The best desktop manager is neither unity or gnome-3 - I use the i3 window manager most of the time.  That means I don't really care what the default windows manager is because I will run my own anyway.  One can still get cinnamon, gnome-3 or mate (these are arguably the best normal wm's for linux) from within Ubuntu.

Monday, April 30, 2012

Indexing Tips for the 1940 Census

These tips were developed by Cindy Snow as a help to increase speed for people who have a membership login on the LDS Family Search website (link) and want to help indexing the 1940 census (you do not have to be a member of the LDS church or have a login to use the FamilySearch site). It is currently posted as a pdf but eventually I hope to put it up as html.

https://www.dropbox.com/s/a5n8pmob97dvjyk/IndexingTipsFor1940Census.pdf

Monday, February 6, 2012

R and Rserve on Windows

This is easy if your system is 32-bit.  If it is 64 bit you need to make sure you are using 32-bit R because the R serve binary is 32 bit!
  1. Install the windows R binary package (accepting the defaults)
  2. Put the R bin directory on your path (right click computer  Advanced Properties  Environment Variables).  
    • For a 32-bit Windows install you should use a path like this:  C:\Program Files\R\R-2.14.1\bin
    • For a 64-bit Windows install you need to link to the i386 folder: C:\Program Files\R\R-2.14.1\bin\i386
  3. Fire up R from the cmd line (make sure that it is the 32 bit R, even if you are on a 64-bit computer) and execute the command: install.packages("Rserve") -- note to where it installs Rserve.
  4. Copy the binaries Rserve.exe and Rserve_d.exe to your R bin directory referenced aboved.
  5. Fire up a new cmd line and run the command: "R CMD Rserve' and configure the firewall popup to allow rserve to work.
  6. You know if everything is working if you can execute this code inside of irb (depends on rserve/simpler [gem install rserve-simpler]):
    • require 'rserve/simpler/R'
  7. Remember to start rserve from a separate commandline window before running any other code.  Also remember that you only get one connection in windows... so make it count.

Monday, August 8, 2011

*Listen* to Youtube on linux (legally)

Per the terms of service, you are not supposed to download YouTube videos. However, it does NOT say that you cannot view them in something other than a web browser.  The main problem with youtube is how much garbage/dodginess there is.  Also, most of the time I just want to listen to the music anyway.... what to do?

The answer: use youtube-dl to provide the correct download link, then stream to mplayer and null the video.

Steps:
  1. Download youtube-dl and put somewhere in your path (such as ~/bin/) and make executable.  If your player breaks, just download the latest version (up within 24 hrs of a youtube site modification) and it should work again.   They have a youtube-dl .deb package in the ubuntu repos, but it is obsoleted pretty fast (for instance 10.04 doesn't work).
  2. make sure mplayer and python are installed: (sudo apt-get install mplayer python)
  3. Use this command:
mplayer -vo null -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g -f 34 --cookies /tmp/cookie.txt "http://www.youtube.com/watch?v=pGruu89cCw8")


Of course, you will change the video link to be the one you like.  Here is some explanation of what is going on:
  • Youtube requires cookies to be enabled.  We get the video link via youtube-dl and put it into the cookie file.  mplayer is using cookies and reads the url to play from the cookie file.
  • The -g means get the url, and -f changes which file format you are getting the link to (look up youtube codes... current options are 5, 34, 35, 18, 22, 37, 38, 43, 44, 45, 17).  34 is the lowest resolution flv format at 128 kbits/s sound (and I think is standard "360").  18 would give you 96 kbits/s sound.   
  • -vo null means no video output.  Use -fs instead if you want full screen, or nothing for that option if you want regular.
There you have it.  Robust, legal, streaming audio player for youtube.

This also seems to work on short playlists, but not always:

mplayer -vo null -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g -f 34 --cookies /tmp/cookie.txt "http://www.youtube.com/view_play_list?p=460F66B8E8E56FB6")


Navigate through the tracks with ">" and "<".



Monday, April 11, 2011

rvm with Ubuntu 10.04 and 10.10

If you plan on doing a lot of development in ruby, then rvm (ruby version manager) is the way to use lots of different ruby versions and gems. If you just want to run ruby, you should use your system's package manager.

This is a condensed version of Chistopher Irish's excellent write-up

(leading $ is the bash prompt)

$ sudo apt-get install curl git-core ruby
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

If you haven't already replaced your .bashrc, you probably have a line in there like this:
[ -z "$PS1" ] && return

Replace that line with:

if [[ -n "$PS1" ]]; then

Then, add this to the last line of the .bashrc file (however, you can leave off that very final, dangling 'fi' if you did NOT have a return statement that you replaced earlier).

if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi

fi

There are going to be prerequisites to installing most ruby's. Use the command rvm notes to discover those dependencies for your system.

Okay, we'll grab some prerequisites for compiling 1.9.2:

$ sudo aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf

Now, we can list the ruby versions we can install, install 1.9.2, and set it as default.


rvm list known  # see which ruby versions we could install
rvm install 1.9.2-head
rvm --default 1.9.2-head  # make ruby 1.9.2 our default