Reading list for 09-15-13

September 15th, 2013

Slashdot – Retail Stores Plan Elaborate Ways To Track You

Hacker News – Meet the Hackers Who Want to Jailbreak the Internet

Hacker News – Introducing Cornucopia, the food printer

WordPress News » Releases – WordPress 3.6.1 Maintenance and Security Release

Schneier on Security – The Public/Private Surveillance Partnership

Schneier on Security – Surveillance and the Internet of Things

Announcing WordPress plugin Share From Tiny Tiny RSS in beta

September 15th, 2013

I follow a few RSS feeds on my phone using Tiny Tiny RSS and its Android-based companion ttrss. There are three qualities you can toggle about a given story: read, star, or published. I typically star items I want to follow-up on and publish items I want to link to here. It is annoying to open a bunch of tabs and copy-paste URLs. Tiny Tiny RSS has an API, so I wrote some code to eliminate that annoyance. I gave it the extraordinarily creative name Share from Tiny Tiny RSS. Download Share from Tiny Tiny RSS.

Moments after this post is published, this blog will feature the first-ever production use of this script. Hoorah! History in the making! Loud exhaling that sounds like a crowd approving!

I’m calling it a beta because I’d like to do a little more testing before I gloat. Unless somebody finds some bugs (which is unlikely given that this blog has approximately 1 reader, who is also its author and the plugins only tester/user and, incidentally, is both brilliant and humble), I’ll upload it to WordPress’ plugin directory and announce it on my professional site.

EDIT 9/16/2013: I have since announced an updated version on my professional site.

A vocab note: An article on a blog is called a post. This plugin can accurately be describe as creating a post based on a list of posts, but the term “post” gets ambiguous pretty quickly. In minimize confusion, I’ve taken to referring to the list of posts generated by Tiny Tiny RSS as stories. I only use the word “post” to refer to the article this plugin creates on your WordPress blog.

This plugin will add 2 pages to the admin sidebar, one under Settings, the other under Posts. Both pages have the name Share from Tiny Tiny RSS.

  • The settings page pretty much just saves your credentials and allows you to test their validity and create a test post. Creating a test post is exactly the same as going to the Posts->Share from Tiny Tiny RSS.
  • The one under Posts is where the action happens. It will show you a very rough preview of the contents of the post, and if you like it, you can save it. Otherwise you can navigate away.

Features

  • Create posts as drafts or publish immediately.
  • “Un-publish” stories that were included in the post. If post-creation fails, it won’t un-publish your stories, minimizing your chances of data loss.
  • If you use Tiny Tiny RSS anyway, this plugin makes it easy to create fresh-content for your blog with minimal effort, which makes it great for a blog’s SEO.

Known issues

  • If your Tiny Tiny RSS instance is at http://example.org/ttrss, then your API is at http://example.org/ttrss/api. This does not check for /api at the end – it’s up to you to remember to add it.
  • It does not support multiple users – it stores one set of credentials only. You cannot currently have two WordPress users with separate TTRSS installs.
  • Although ttrss on my phone supports marking items as published with a comment, I’m not seeing my comments returned in the API. That may be because I’m running an old version of Tiny Tiny RSS. Either way, this plugin will be a lot more useful if/when it can join your comment with your link.
  • It stores your Tiny Tiny RSS credentials in plain text.
  • There is a race condition: When you first go to the Posts->Share from Tiny Tiny RSS page, it will generate a rough preview of what your story will look like. If you mark an item as “published” after generating your preview, then save the post, it will contain the newly-published story.

Future features

Besides fixing the known issues indicated above, I have a list about a long list of proposed changes. The highlights include:

  • Automatically creating a new post at a specified interval – This was actually how this post originally worked, but I found it to be buggy in my test environment. In my dev version of this plugin – not (yet?) released – has this mostly implemented already. It will also offer to only create the post if there’s some minimum number of articles marked as published.
  • Introductory text at the beginning the post – Allow the user to set some blurb they’d like to have appear at the beginning of each post this plugin creates.
  • Allow the user to set their own subject.
  • Automatically attach tags/category to newly-created post.

Acknowledgements

While creating this plugin, I referenced code in the following plugins:

I originally wanted to license this under Affero, but that means that each post it creates would have to have a way to download the plugin, so that users seeing it used over the Internet would be able to download it too. That seemed like a level of text spam that just wasn’t worth it. If you feel like putting such a footer in your post, I would be tickled. That said, I don’t plan to.

Upgrade WordPress automatically

July 7th, 2013

WordPress has a one-click upgrade feature, but it requires you to give it your FTP/SFTP credentials. If you log into SSH with keys instead of passwords, you can’t use it. I wrote a script that runs on the server (thus it needs no password or special permissions) to back up your current files, then upgrade.

Lines 6 through 10 features variables that you’ll probably want to alter before you run this script.

A few notes:

  • It only backs up the files, not the database, so if WordPress has a database update that breaks your database, hopefully you’ve got some other backup in place.
  • Sometimes after an update, WordPress will prompt you to please update the database. This script will not do that step – you still need to log in and click the button. This script will send you a reminder that an upgrade has been performed and which will allow you to both confirm that nothing was broken, and click the aforementioned button. I don’t trust myself to act on that reminder promptly, so I haven’t set this script to automatically run. Instead, I have a reminder on my phone to go run it manually.
  • A future version might delete all the old backups (both WordPress versions and websites).


#!/bin/bash
# Created Sept 1, 2012
# Last updated July 7, 2013
# Automatically update WordPress.
 
# Alter these to reflect your environment
website='~/public_html' # website and htdocs might be the same. If unsure, keep them identical.
htdocs='~/public_html/htdocs'
email='you@example.com'
sitename='My web site'
 
date=`date +%y-%m-%d`
log=wp_upgrade_${date}.txt
 
if [ -f latest.zip ]; then
rm latest.zip
echo Removed old latest.zip >> $log
fi
 
wget http://wordpress.org/latest.zip
echo Got latest version of WordPress >> $log
 
unzip latest.zip
echo Unzipped latest version of WordPress >> $log
 
# Create old/ if DNE
if [ ! -d old ]; then
mkdir old
echo Created directory for old stuff >> $log
fi
 
# Create a backup of your website before making changes
htdocs_dir=`basename $htdocs`
new_htdocs=${htdocs_dir}_{$date}
cp -Rv $htdocs old/$new_htdocs
 
echo Copied htdocs to $new_htdocs >> $log
 
# Put the files for the new WordPress version into your website.
cp wordpress/* $htdocs -Rv
 
echo Dumped new WordPress into htdocs >> $log
 
# Archive this version of WordPress. You could probably delete it, but I like to have a clean copy around in case I muck up the code.
mv wordpress/ old/wordpress_${date}
 
echo Copied pristine WordPress code into old/ >> $log
 
# Sometimes it has database upgrades and a human needs to visit the site
# to tell it to go ahead, so this e-mail serves as your reminder.
mail $email -s "Wordpress updated on $sitename - go check it out" < $log

Assuming you store this in ~/bin/upgrade_wordpress.sh, you can run this script monthly automatically with the following steps:

  1. At a prompt, type 'crontab -e'
  2. On most systems, this will open vi. Type "i" to insert text.
  3. Paste:
    0 0 1 * * ~/bin/upgrade_wordpress.sh
  4. Push the ESC key to exit insert mode.
  5. Type ":wq" to write changes then quit vi

“I have got distributed your internet-site during my internet sites”

May 13th, 2013

Below are (excerpts of) real spam comments posted on this very blog that made me laugh. My apologies to anyone who may have been trying to convey a serious comment; when in doubt, I spam-bin.

First, the one which is excepted in this posts’ title.

That’s extremely attention-grabbing, That you are a good too much skilled tumblr. I have registered ones give food to and search in front to be able to seeking more of the outstanding write-up. Moreover, I have got distributed your internet-site during my internet sites

nevertheless, you command get got an edginess over that you want be handing over the following. ill for sure come more in the past again since precisely the same just about a lot continuously inside of case you defend this increase.

I look forward to seeing you in the past again!

…You’re an exceedingly knowledgeable doodlekit. I have got registered your own feast and search in advance in order to searching for further of this exceptional posting. Additionally, I’ve got embraced your website in my myspace

People stopped using MySpace like seven years ago. You must be so lonely, being its last user. Tom, is that you?

…I will be bound to book mark them accessible to know more of one’s handy data.

That’s just what my mother always says, “Mark them accessible to know more of one’s handy data.”

Precious information. Blessed me I discovered your web site by chance, for stunned the reason this kind of accident failed to occurred prior!

For the first sentence and a half, this comment had me going. People prefix sentences with “Blessed me” in the south right? Could Scarlet O’Hara – who historians have long assumed died during her circumnavigational flight of the globe in 1937 after World War II’s famous supercomputer Skynet became self-aware and declared war on all humans – have posted this very comment?

Alias `su 0` to `su -`

April 22nd, 2013

You can only alias a command, not a command + argument(s). The process of automatically fixing oft’ mistyped arguments involves 2 steps:
1. Alias the command to a shell script
2. Write shell script to replace the erroneous argument with the real one.

For step one, create the following alias:
alias su="~/bin/su_improved.sh $@"

Although I found many sources claiming you can’t redirect all a commands arguments to another command, $@ does exactly that. I mention this in case my system happens to be the exception rather than the rule.

The script, ~/bin/su_improved.sh:

#!/bin/bash
# Alias 'su 0' to 'su -'
 
# Created by KJ Coop on Sun Apr 21 23:24:28 PDT 2013
# Yoinked from http://kjcoop.org/2013/04/22/alias-su-0-to-su/
 
if [ "$1" == "0" ]; then
    # I can't `su - @#` because it expands into `su - 0...` so I'm just
    # assuming there's a max of 2 arguments: su [dash] [username]
    su - "$2"
else
    su $@
fi
 
exit 0;

Eliminating Suse splash screen forever

March 2nd, 2013

This trips me up every time I set up a new system. I go into the process remembering that I get tripped up somewhere, but retaining no details about what I should do differently. I am posting this in the hopes that next time I’ll remember to look it up here.

The first step – the one I tend to remember – is to alter menu.lst: for each entry, change splash=silent to splash=verbose and remove the word quiet.

That will remove the splash screen from all the existing boot options, but when an update inevitably adds a new kernel, it will get the default options, including the splash screen. Thus the second step – make a similar change to the default options stored in /etc/sysconfig/bootloader. The line describing the default options starts with DEFAULT_APPEND; remove the word quiet and change splash=silent to splash=verbose.

I had this experience yesterday

February 16th, 2013

Fry: Not sure if weird feeling is stress or absence of stress

Incidentally, this is narrower than most instances of this meme because of this bug, which most definitely caused me to feel stress, pin this image.

Shrink Twitter widget’s min-width from 220 to 190

February 1st, 2013

Today I added a Twitter timeline to this blog’s sidebar, and I noticed it was expanding a little bit beyond the borders of the box. Twitter’s guide indicates the timeline will automatically shrink to the size of the parent, but that was not happening, I’m guessing either due to margins/padding or a hard-coded minimum. Twitter’s suggestion of adding width=”190″ to the containing element failed, but I was able to override it’s min-width property by adding the following to my stylesheet:

#twitter-widget-0 {
    min-width: 190px !important;
}

You might want to use Firebug to double-check the ID. If you have multiple timelines, each will have its own ID; I suspect there’s a class or something you can use to resize them all in one fell swoop.

Although I would have liked to the min-width to a smaller value, the box stopped shrinking at 190 pixels.

In my brief internet search, but I didn’t see this suggested elsewhere. Hopefully this will save somebody a little trouble.

DIM Planner: The System So Far

November 30th, 2012

I love productivity porn: seeing how things are organized, reading about better systems to attempt to deal with the unending influx of things to do. I love finding new ways to bring order to disorder – that’s my favorite part of programming.

For most of my adult life, I’ve been going back and forth between using paper or computer systems. Right now the pendulum is tilting heavily toward paper. It’s an unholy amalgamation of my vague recollections of GTD, DIY Planner templates, and the calendar on my phone.

Principles

As I indicated above, some of these come from GTD, some of them are rules I made up, some are probably ripped off from other productivity books. Many of these principles are surely one or more of the above.

  • The system must not require me to write anything down more than once. A lot of planners come with monthly and weekly pages, but I cannot be trusted to consistently write the same piece of information down twice.
  • Similarly, I just can’t get in the habit of looking in two places for one set of information – in the example above, checking two calendars won’t happen: I’ll check on and forget the stuff on the other one.
  • I don’t have an office, so it’s imperative the system remain a size that is practical to cart around with me.
  • The system must let me get the odds and ends out of my head and into paper. I have an awful memory – anything that exists solely in my head will not exist for long.
  • I’m easily distracted. At any given moment, there are at least a dozen things I’d like to be doing. There are almost always dozens more floating around in the recesses of my brain. The rate at which I come up with cool stuff to do vastly exceeds the rate at which I can do them. This system is an attempt to cope with that.

Physical components

The backbone of my system is a one-inch binder with roughly 5 sections. I say “roughly” because I’m so cheap that I didn’t want to buy more than one set of tabbed dividers, so the tabs represent general groupings. You can download the templates I use as PDFs or Open Office Draw files.

  1. Brain dump – This section consists of the sheet titled “Prioritizing table”. It comes before the first tab. I want to be able to open the binder, dump the contents of my brain, and go back to whatever I was doing with minimal distraction.
  2. Daily Diary – I use this to both record information about the day that passed, and layout a plan for the day ahead. As a freelancer, I often experienced the blessing/curse of having an unstructured day, and I like to have a record of both what I intended to do, and what I actually did, so that way I can see how productive I was, or if things took me longer than expected. There is one page per day, double-sided. I usually don’t print more than a couple days in advance. If I have something to remember that is farther in the future, I rely on the calendar on my phone.
  3. Projects – each project has its own page and they’re alphabetical by title. At the beginning of this section, there’s a list of projects and their next steps. I review my projects every Monday and write a new list for the upcoming week. Last week’s list – and any projects finished that week – get stapled up with that week’s daily diary sheets.

    In Getting Things Done, David Allen describes a project as anything with two or more steps, but I find that definition to be a little unwieldy – I don’t want to make a new project page for every load of laundry. My guideline is anything I’m not likely to finish in one sitting.

    This section is both the most used and most heavily under construction – a lot of projects are sub-projects of others, and paper just doesn’t deal with that well (at least not in a system that needs to be portable). I’m trying to live with the fact that the project pages are necessarily rough and imperfect, but I’m finding that surprisingly difficult to accept.

    There are a few different pages for different types of projects

    • General project – mostly just a checklist
    • Reading project – I usually keep notes as I read a book, and I often plan to review it on the internet when I’m done. This sheet first serves as a home for my notes as I read the book, then as a guide while I write the review.
    • Web project – includes all the steps that will be in every web project I do, whether it’s for a client or my own amusement.
  4. Reference – This is mostly just a collection of lists – tools that are useful for new clients, skills I want to improve, random business ideas. There are also some really specific pages in here:

    • Financial – as mentioned above, I freelance, which means that when tax time rolls around, nobody mails me a handy W2 summarizing what I made in the previous year. Every time I get paid, I enter it here. In the future I may expand this to include a detailed accounting of business expenses I planned to deduct, but right now, I don’t have enough deductions to make it worth my while.
    • Password lists – I have like 3 pages of passwords just for my own person, and another few pages for clients. There is just no other way to keep all that information in my head (see above – things that exist only in my head will not exist for long).
  5. Maybe/Someday – David Allen calls this a “tickler” file. Some pages are just lined paper of hare-brained ideas to consider when I have time (HA HA!). There are also some project pages in here – a lot of times, in my excitement, I make a project page and dump my brain out, only to realize a few days or weeks later that it’s not going to top my list of priorities any time soon, at which time it gets moved to the Maybe/Someday tab. I’ve always got about 30 things going on in my brain at once, and if I keep low priority projects in the projects tab, that means I’m routinely flipping past them, seeing them and getting distracted by them. This is a fairly new practice, so as of yet, nothing has moved from the Maybe/Someday tab back into the Projects tab. I’m open to the possibility that this section will become a place where projects go to die.
  6. Extra paper – Pretty self-explanatory. Some are template pages described above, others are blank. I try to keep at least one blank of any given template so that way I can copy it, rather than having to print from the computer (My printers has limited support for Linux).

Behavior

On Sunday, I print a new “Project List” and “Weekly” pages. I culled a lot from the “Weekly” page that you downloaded because this will vary so much from person to person, but I tried to keep enough stuff there to give you an idea of what stuff you should add.

My first order of business Monday morning is to SKIM my e-mail and make sure there are no production servers in distress. Provided I don’t have any fires to put out – and I usually don’t – my second order of business is to fill out the Project List. This consists of flipping through the Projects section and ascertaining the next action for that project. If I don’t think to get to it in the next 7 days, I move it to the Maybe/Someday section. If I do plan to get to it, I write it on the list. Then, I go through the Maybe/Someday section and see if there’s anything on the back burner that needs work in the upcoming week. If so, it gets written down and moved up to Projects. I try to limit my Project List to one page, so that way I can double-side it with the “Weekly” page.

When that’s complete, I staple together previous week’s Project List, Weekly and Daily Diary pages and put them in storage with the other stuff I keep for sentimental purposes. As I typed that, I realized it sounds like kind of an odd pairing, but it works (see above about stuff that only exists in my head – I’ve already forgotten the exact phrasing I used when I wrote that section 20 minutes ago.)

Once or twice a day, I go through the brain dump section and copy the items to project pages or whatever. Not everything needs to be a project – for example, if I want to call a friend on their birthday or text them a funny story. You may think, “Who writes that on their to-do list?” See whatever I wrote up there about my brains being unreliable.

If I have an especially hectic day or week ahead of me, I’ll use a Prioritizing Table to try and prioritize all my activities (thus, the name).

It’s very much a work in progress. Since I first drafted this post 3 weeks ago, I’ve started rereading GTD and revising this system. I may post updates to this system. I know I totally love geeking out on other people’s systems, so I hope I can provide others with the same thrill.

Megameme

November 13th, 2012

My favorite new meme is “Go home [thing], you are drunk”. I’ve seen it three times in the past couple days, but I only remember two: this one and this one.

I was recently lying in bed trying to go to sleep when I suddenly had an urge for fried food. Instead of going to sleep or eating fried food, I pictured an internet meme:
Ahh, time to slee- HEY LET'S GO EAT!

Naturally, the next step was to try to work “Go home brain, you are drunk” into it somehow.
GO HOME BRAIN, you are drunk.

When I realized I had used 3 memes in one, this was the logical next step:
FOUR MEMES IN ONE IMAGE I AM AN INTERNET GOD

As an aside, today I’m celebrating 13 years vegan. Hoorah!