The Eclectic Quill

Website of Joshua McGee

By

Have Mac OS X alert you when you are back online

Network connection down?  Want Mac OS X to announce to you when you are back online?  Turn up the volume; start Terminal (by clicking on the Spotlight magnifying glass in the upper right of your screen, typing 'terminal', and hitting Return); type or paste the following into the window; and hit Return:

while true; do ping -c 1 8.8.8.8 && say "Back online" && break; done

This will speak the words "Back online" to you when your network connection is reactivated.

Why this works

  • while true; do <some command>; done will repeat the specified command until it hits a break statement
  • ping -c 1 <some IP address> will send one packet to the specified IP address, returning true (if the server responds) or false (if the server cannot be reached or fails to respond)
  • 8.8.8.8 is one of Google's public DNS servers, which should always be online and always respond to pings
  • say "<something>" will use the built-in text-to-speech synthesizer to speak the given text aloud and return true
  • break will exit the infinite loop
  • && chains commands, executing each only if the preceding command returned a value of true

Putting these together, this command will send one packet at a time, forever, to a server that should always respond, and the first time the server responds, it will tell you that you are back online and stop checking.

By

Connect Dropbox to Ubuntu 14.04 from the command line

Here is how to connect your Dropbox account to a headless computer running Ubuntu 14.04 Trusty, from the command line, without using Nautilus.

dropbox-plus-ubuntu

Create a directory to store your Dropbox files:

mkdir ~/Dropbox

Add the Dropbox repository to your package source list.  Open the list in an editor:

sudo nano /etc/apt/sources.list

Paste this line at the end, save, and close:

deb http://linux.dropbox.com/ubuntu trusty main

Import the dropbox GPG key:

sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E

Update your repository information:

sudo apt-get update

Install Dropbox:

sudo apt-get install dropbox

Install the Dropbox daemon (answer 'y' if asked):

dropbox start -i

Get the link to attach your Dropbox account (this step is poorly documented):

~/.dropbox-dist/dropboxd

You will get a response like this:

https://www.dropbox.com/cli_link_nonce?nonce=somelongstring

Paste that link into any browser, hit the "Connect" button, and be sure to hit "Continue to Dropbox":

Configure Dropbox to start when the computer starts:

dropbox autostart

Start the sync:

dropbox start

Watch the status of your sync if you like:

watch dropbox status

… and you should be good to go!

By

Recycling begins at school

I was a budding environmentalist from an early age and tried to be aware of the waste — and opportunities for recycling and reuse — that I saw around me.

When I reached junior high, I became increasingly aghast at the amount of paper that was being wasted.  Nearly every day, each teacher would have printed a sheet of 8.5" × 11" paper for each student to take home: assignment instructions, test schedules, calendars of events, and so on.  Often you'd get more than one in a day from a teacher.  They were printed on various colors of paper, with varying amounts of text.  Sometimes a whole sheet was devoted to a few printed lines.  And I knew that the vast majority were taken home and thrown away.

In eighth grade, I hatched an idea.  Rather than recycling the sheets of paper throughout the year, I started saving them in a box.  By the end of the school year, I had accumulated an entire ream.  Of course, every other student had received the same amount.

The last weekend before classes ended, I undertook my project.  I walked to the hardware store and bought scraps of 1×1 wood for pennies from their scrap bin.  I bought the minimum amount of window screen material I was allowed to purchase.  I took the supplies home, nailed the wood into frames, and tacked the screen material tightly across them.  I separated the paper by color, tore it into shreds and, using my mom's Osterizer blender and hot tap water, pureed the shreds into pulp.  I spread the pulp onto the screens.  I embedded fallen flower petals scavenged from lawns.  I flipped the layers of pulp onto newspaper, covered them with more newspaper to absorb excess moisture, and added weights to flatten the sheets.

Voila.  Handmade recycled paper.

They turned out far better than they had any right to, given my lack of craft ability.  They were gorgeous.

On the last day of school, I took the sheets of paper and, class-by-class, gave five or six sheets to each teacher.  After they marveled and thanked me, I described the project:

"I made this from paper sent home with me over the school year," I said.  I paused dramatically.  "I was able to make a lot of it."

I went off to high school the next year, so I never knew what came of it.  But in my dreams, I hoped that the teachers would glimpse their gifts and think carefully about whether that next sheet of paper needed to be printed for every student.

By

The “pseudo-theology” of ISIS

Dabiq is a town of roughly 3,300 people located in what is present-day northern Syria, six miles south of the Turkish border, but it holds disproportionate significance to a large subset of the world's population.  Quoting from Wikipedia:

In Islamic eschatology as found in the Hadith, the area of Dabiq is mentioned as a place of some of the events of the Muslim Malahim (which would equate to the Christian apocalypse, or Armageddon)."  ISIS uses "Dabiq" as the title of its propaganda magazine for this reason.

Today (July 27, 2015), the U.S. government announced that it will be working with the Turkish government to try to "clear" roughly 1,500 square miles (4,000 square kilometers) of Syria of ISIS militants to create an "ISIS-free zone", which would presumably then be occupied by some armed force or forces other than ISIS.  (Surely not coincidentally, this would also break the contiguity of proto-Kurdistan, which would be a happy event for the present Turkish government.)

On today's episode of The Rachel Maddow Show, Dr. Maddow made a puzzling comment.  She noted that this 1,500 square miles includes "Dabiq, the geographic heart of what ISIS claims as its radical, pseudo-theological, end-of-the-world reason-for-being."

First off, this sentence is hopelessly broken.  ISIS is not claiming a "pseudo-theological" raison d'être.  It is claiming a theological one.  I've been trying to figure out what that qualification "pseudo-" is supposed to convey.  I've only come up with three possibilities:

  1. That Maddow is trying to say that theological claims are simply a smokescreen for the real goals of ISIS
  2. That Maddow is opining that any religious beliefs held by ISIS are not systematic or scholarly enough to be considered "theology"
  3. That it's a dog-whistle that says "Wink wink, you and I both know that ISIS' beliefs are not the real word of god, and definitely most Muslims know they're not."

As much as I respect Rachel Maddow, I'm inclined to think it is number three, which is disturbing for a number of reasons, not the least of which being that it plays directly into ISIS' hands.

More than anything, though, I'm reminded of a conversation I had with a stranger one hot summer day in Hardwick, Vermont.  We started talking about religion, and the conversation turned to Wiccans.  She scoffed.

"Wicca is just a cult," she said.  "None of them has ever held a piece of rowan wood and felt its real magic."

Can you make sense of it?

By

Customizing Lograge: Removing and adding fields

Lograge is a great Ruby gem for flattening your log files.  But as the author himself notes, "Lograge is opinionated, very opinionated."  Perhaps your opinions differ.  Mine did.

For instance, I don't need to log the controller, action, and format of requests.  I can infer those from the request path.  What I do care about is the time of the request, the User-Agent of the browser, and whether the request is by a search engine or not.

The following code mutes logging of controller, action, and format, and adds a timestamp, the User-Agent, and an attempt to identify search engines (via the Browser gem).  You end up with log file lines that look like this:

method=GET path=/ status=200 duration=200.29 view=53.22 db=40.01 time=2015-07-26 18:25:48 +0200 search_engine=false user_agent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0

method=GET path=/commander/mayael-the-anima status=200 duration=533.39 view=112.51 db=166.25 time=2015-07-26 18:27:40 +0200 search_engine=true user_agent=Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)

Use the code as-is, or as a jumping-off point for expressing your own opinions in your logs.