Latest links on Pinboard

My Pinboard RSS Feed

Clean Up Facebook with a Greasemonkey Script » 1number of comments:

Facebook has been deteriorating lately; the signal-to-noise ratio is going down. The news feed is cluttered with quizzes like “Which Disney princess are you?” and with people becoming “fans” of things like music and water.

Fortunately, there are people out there who have fixed these problems for us, with an incredibly useful little Firefox add-on called Greasemonkey. If you don’t have it already, just click that link and click “Add to Firefox.”

Next, we’re going to install a script to make Facebook look like this:

After you’ve added Greasemonkey to Firefox, click on this link to install a script that will strip out Facebook ads, make it have only two columns instead of three, block app invites, and remove “fan” pages and apps from the Highlights and news feeds.

You’ll be left with just the signal without all the noise.

Command Line Tools: weather, todo, wget, tweet, and solve » 0number of comments:

Now that Cygwin is just a keyboard shortcut away, it’s time to explore a little of what it can do.

Download files: wget

This is a tool built into Cygwin that makes it easy to download files without needing a web browser. Simply type wget [a url] to download a single file.

But wget has a lot more features than that. For example, if you want to download a lot of files, you can save a list of URLs to a text file, putting each URL on its own line. Then, open cygwin and type wget -i listoffiles.txt and wget will download each file, one after another.

If you’re looking for more interesting ways to use wget, you’ll probably find this Lifehacker post relevant.

Get weather forecasts: weather

When we’re finished, you will be able to type the word weather into the console and get back a list of current local weather conditions and a local weather forecast (example). We’ll be using a shell script written by Jeremy Stanley to make this happen.

NOTE: Since this script pulls its forecast information from the U.S. National Weather Service, forecasts are only available for US territories. However, international readers can still get their current weather conditions since that data is provided by local airports.

  1. Download the latest version of the script.
  2. Open it by typing tar -xvf [filename] and change to the new folder by typing cd [new folder name].
  3. optional If you want to try the script out, typing in ./weather ATL will return the current conditions at the Atlanta airport.
  4. Now, to get your local conditions/forecast, you’ll need to edit the weatherrc file in your favorite text editor. Add the following lines to the top of the file (after the copyright notice).

    [default]
    Forecast = True
    City = Greenville Spartanburg
    St = SC
    ID = KGSP

    That’s the configuration to get my local forecast. To get yours, we’ll need to change the city, st, and ID variables to your location.

    To get a forecast, you’ll need to put in a city that the National Weather Service provides information for. Go here and select your state to find what cities are available. If you don’t want a forecast, just delete the Forecast = True line.

    To get current conditions, you’ll need to provide the METAR id for your nearest airport. Go to this map and click on the city closest to you. Under the map will be the METAR id for that airport.

    Save the weatherrc file and type ./weather into cygwin. It should give you a local forecast with current weather conditions.

  5. optional Let’s make it so that you can get your weather from anywhere in the file system and so that you don’t have to type that annoying ./ beforehand. We’re gonna have to move some files around.

    If it doesn’t already exist in your home folder, make a folder called bin (mkdir bin). Move just the weather file to that folder. Make sure it’s executable by typing chmod +x weather.

    Next, type python -c "import sys ; print sys.path" to find out where to put weather.py and weather.pyc. I put mine in /usr/lib/python2.5

    Then, move weather.1 and weatherrc.5 to /usr/share/local/man/man1, which is where cygwin stores manual files. (Once you do this, you can type man weather or man weatherrc to find out more about how to use this weather script.)

    Finally, move weatherrc to your home folder. I recommend renaming it .weatherrc, which will make it invisible to the ls command.

    Now, you’ll need to make sure cygwin knows to look in the bin folder for the weather script. Open the .bash_profile file in your home folder and make sure these lines are included and not commented out:

    if [ -d "${HOME}/bin" ] ; then
    PATH=${HOME}/bin:${PATH}
    fi

    Once you’ve done all that, type weather into cygwin, and it should give you the forecast and current conditions no matter where you are in the file system.

Manage a todo list: todo

Gina Tripani from Lifehacker has started an open source command line todo list manager. Once installed you can type things like todo add "Write blog post" to add an item to your todo list, todo ls to get a list of things to do, and todo do 1 to cross off the first thing on the list, and a lot more.

You can find plenty more about the script and how to install it at the link above.

Update twitter: tweet

This python script will let you easily send messages to Twitter from the command line. Simply copy and paste this code to a text file and save it as tweet.py (ideally in the bin directory you made above). To make it even more convenient, comment out or delete these lines:

user = raw_input(‘Username: ‘)
password = raw_input(‘Password: ‘)

and replace them with:

user = “your twitter user name”
password = “your twitter password”

Then open the .bash_profile file again and add this line to the bottom of the file:

alias tweet=’tweet.py’

Now you can type tweet "Message to send to twitter" to send tweets from the command line.

Solve math problems: solve

This one is easy: simply add the following lines to the end of your .bash_profile file:

function solve () {
awk “BEGIN { print $* ; }”
}

Now you can type solve "2*(3+4)" and it will return 14.

Hope you all find some of these tools useful! If you have any that you want to share, feel free to leave a comment.

Command Line Tools, Post 0: The Quake-Style Command Line » 4number of comments:

I am rediscovering the joys of the command line.

After a couple years of service, my laptop was getting sluggish. After the delays finally became intolerable, I ordered a new hard drive and reinstalled my system from scratch. In addition to making the laptop faster, the process has gotten me to reexamine some tools I had previously neglected.

Chief among these is Cygwin. Linux has a lot of useful command line tools, and Cygwin makes these tools available for Windows. I use it to get the weather, manage a todo list, download files, do math, and even send updates to Twitter. Why use the command line for these tasks, when there are good graphical ways of doing them? Because it’s really, really fast.

The command line drops down over my other windows, like a video game console, at the press of a simple keyboard shortcut. Then it’s just a matter of typing in what I want.

I’ve written about how to set this up before, but a few things have changed since then. Here’s how to set up a Quake-style dropdown command line.

  1. Install Cygwin. I use the e text-editor, which automatically installs Cygwin with a bunch of useful packages in order to enable its more advanced features.

  2. Install AutoHotkey. (By the way, this program has a lot more uses than just this drop-down command line. It’s something I know I haven’t explored to its full potential yet.)

  3. Install Console2. This is a free and open source console program, which is much prettier than the standard Windows Command Prompt tool. You’ll want to install the latest beta version of the software (the stable version hasn’t been updated in years). For reference, I’m using Beta #144.

  4. Download console.xml and consolecywgin.xml and put them in the same folder as Console2, replacing the console.xml file that is already there.

  5. In the Console2 folder, right click on Console2.exe and click Create Shortcut. Rename it consolecygwin.

  6. Right click that shortcut and click Properties. In the “Target” field, add -c consolecygwin.xml after the final quotation mark. Click OK.

  7. Open Autohotkey if it isn’t open already. Right-click on the Autohotkey icon in the system tray and click Edit Script.

  8. Copy and paste the contents of this file to the end of the AutoHotkey.ahk file that appears.

  9. Save and close the AutoHotkey.ahk file. Right click the Autohotkey icon and click Reload This Script.

Now if you hit the Windows Key and the ~ key, you’ll get a regular old DOS prompt. Hit Windows Key + Shift + ~, you’ll get the Cygwin prompt. Type exit into either prompt to make it go away. Press escape to hide the prompt, and press either of the hotkeys mentioned above to bring it back.

In my next post, I’ll go into how to set up some of the neat commands I mentioned earlier.