25 (some)things.

I hate resolutions. I hate when people say they hate resolutions. But, here I am, hating resolutions. I also hate that I gained over 40lbs during 2020. All this hatred has to be redirected…

I didn’t start a resolution on the 1st, because if I miss one day, my OCD punishes me fiercely. So I often start a few days later. Then it’s just a thing I’m doing, and not a resolution for the year. Is it different? According to my broken brain, yes. Lol.

ANYWAY, this year, I partnered with a friend and co-worker to do an exercise accountability thing. He offered to do “something” with me daily (we’re on opposite sides of the country, so “together” means virtually and just encouragement from afar). I didn’t want our “thing” go get boring, so I came up with the idea of “25 Somethings”.

Here’s the gist: Every day, we need to so 25 of something, and message each other when we’ve done it. The 25 things can be anything. 25 pushups, 25 jumping jacks, 25 eye blinks — whatever you have the time and motivation to do. But we have to do 25 of something and then message each other when it’s done.

Yes, we could message each other that we “ate 25 Doritos” — but we’re only hurting ourselves in that case, and it’s honestly a little embarrassing to send a message like that to someone who responds with “ran 25 miles”. So sure, shame plays a part, lol.

Anyway — it’s been really awesome so far. I’m grateful for an accountability partner, and the 25 things has been great for both of us. Some days the 25 things are less awesome than others. For example, I’ve had several “25 jumping jacks” days in a row. That’s kinda lame, but it’s something I can do quickly with limited room. And it’s SOMETHING.

So there you go, if you’re looking for a pretty simple exercise accountability plan, feel free to steal ours. 25 things is simple, flexible, and has been pretty great. Happy New Year!

The Family Dashboard

NOTE: This was originally published in Linux Journal, back in 2017. I noticed this morning that my script is still running every day, and I have over 1,100 Bing photos saved locally!

I’ve written a little about PHP before, because I think it’s a great utility language for writing quick things you need to do. Plus, it allows you to use a web browser as your interface, and everyone has a web browser. That makes it very convenient for my family, because I can make simple web interfaces for the various things I normally have to do from the command line. (This is extremely useful when I’m gone to a conference and the Plex server needs to be rebooted, or any of a dozen other things need to be done that are hard to explain over the phone.)

My “Family Dashboard” will look different from yours, but the concept is pretty simple. PHP allows you to execute local functions on the server, and so as long as you can create a bash script that does what you need it to do, it can be launched from the “dashboard” you create for your family. Here’s a sample dashboard file I’ve created, so you can see how simple it is to create a custom page that does what you need it to do (see Figure 1 for a screenshot of the dashboard in action):


<html><head><title>My Dashboard</title></head>
<body>
<h3>You need to enter some commands and possibly options, or just press a button:<br />
<button onclick="window.location='lj.php?command=weather&option=houston'">Weather</button>
<button onclick="window.location='lj.php?command=bing'">Bing Photo</button>
<button onclick="window.location='lj.php?command=uname'">Kernel Name</button>
<button onclick="window.location='lj.php?command=time'">Unix Time</button>
</h3>

<?php

$command = $_GET['command'];
$option = $_GET['option'];

switch ($command)
{
    case "weather":
        echo file_get_contents("http://wttr.in/$option");
        break;
    case "time":
        echo time() . "  <-- that's how I read time! I'm a robot!";
        break;
    case "bing":
        $json = json_decode(file_get_contents("http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"), TRUE);
        $url = "http://bing.com" . $json['images']['0']['url'];
        echo "Here is the image of the day:\n";
        echo "<img src=$url />";
        break;
    case "uname":
        echo shell_exec("uname -a");
        break;
    default:
        echo "<h1>Press a button!</h1>";

}

?>
</body></html>

Figure 1. My dashboard is simple, but it’s just a front end for the code beneath.

First off, copy and paste that code into a file called lj.php and save it onto your local web server. The server needs to have PHP active, but I’ll leave that as an exercise for the reader to set up. I’ve written about installing a LAMP stack before, so it shouldn’t be too challenging to get a web server running with PHP support (see my article “PHP for Non-Developers” from the December 2014 issue) Also, naming the file “lj.php” is only important because if you look at the code, it references itself. If you name it something different, just change the references in the HTML/PHP code.

Before learning how the code works, test it out and watch it work. If you can’t host the file yourself, but want to see it in action, you can use my server for testing. Just head over to here, and it should redirect you to a hosted version of this file. Click the buttons, and see if you can figure out what’s going on. Can you get the local forecast for your area?

What’s with the GET and Switch Stuff?

It’s possible to create a separate PHP file for every action you need to accomplish. That is a lot of PHP files, however, and it still doesn’t give you the ability to receive input to use in the PHP file itself. I want my family to have a single URL, and I want all my code in a single file. It’s just easier that way. First I’ll explain what the $_GET variable does.

As you click the buttons on the page, you should look at the address bar on your browser. When you click on the weather button, for instance, you should see this in the address bar: http://your.server.here/lj.php?command=weather&option=houston.

That stuff at the end is how you tell the PHP script what information you want it to display. All the variables you assign are put into an array called $_GET. So in the weather example above, I’ve assigned two variables. To reference them inside the PHP script, you use the $_GET array. So in the URL above, these two variables are assigned:


$_GET['command'] = "weather";
$_GET['option'] = "houston";

And, you can use those variables in your PHP code. Notice that I’ve actually assigned those two variables to standard variable names, so that it’s easier to reference them later. You can change what variables are sent to the PHP script by changing the information in the URL. That allows the script to be dynamic and provide output based on the input you give it. In fact, the only reason pressing those buttons works is that it loads the page with the arguments already in place! See if you can get your local weather now by changing the “option” variable in the URL and loading the page. Cool, huh?

More Than Just Weather

Since you’re able to send your PHP script variables via the URL, that means your dashboard can do much more than just show the weather. Based on the variables, you can call different commands with the switch construct in PHP. It’s like a CASE statement in other languages, and the logic is pretty straightforward.

You run the switch statement on the $command variable assigned from the $_GET array. If the variable matches any of the options listed as a “case”, it executes the code in that section, then you break; out of the switch construct. If the $command variable doesn’t match any of the case options, the switch executes the default: section at the end. In this example, it’s a message to press a button.

Let’s look at each section to see what’s going on when you press a button (or manually enter the command in the URL).

The Part before the PHP

If you put standard HTML into a PHP file, and don’t enclose it between <?PHP ?> tags, it just sends it to the web browser as HTML code. So the top of the lj.php file is just plain HTML. The text is shown in <h3> tags, and the buttons are created with a little bit of JavaScript that allows them to load the URL specified. If the buttons and JavaScript make you uncomfortable, it’s okay to make standard text links that point where you want them. I just like buttons because they look cool.

It’s important to realize that the buttons aren’t doing anything other than loading the page with $_GET variables assigned in the URL. The buttons themselves don’t execute code, and aren’t anything fancy. You can type the URL out by hand and achieve the same thing. Your family will appreciate it if you make them links or buttons though, because clicking is much easier than typing long, complicated URLs!

Weather

If you click the weather button, or enter the URL by hand to send the $_GET['command'] and $_GET['option'] variables to the script with weather as the command, the switch statement will execute the code inside the case "weather": section.

This is a really simple command that just echoes (prints on the screen) the results from fetching the web page. The file_get_contents function in PHP will get the contents of a local file or a file on the internet. In this instance, you create the URL with your $option variable. If you clicked the button, you’ll notice $option is set to “houston”, but you can change the URL by hand in order to get your local weather. It will accept city names, ZIP codes and even airport codes.

The weather section of the script is the only one that looks at the $option variable, but it’s possible to assign as many variables as you want from the URL. If you assign a variable and it isn’t used, there’s no harm, it’s just ignored.

The Time?

The “time” section doesn’t return what you’d expect for a time button to return. In fact, I labeled the button that loads that page “Unix Time”, because I used the time() function in PHP, which displays the number of seconds that have elapsed since January 1, 1970. That might not seem like a terribly useful number, but it’s very convenient when programming, because you don’t have to parse out hours, minutes and so on. You can click (or refresh) the page a few times, and you should see the number increment.

UNIX time (sometimes called Epoch Time) is fun to play with, and although this example isn’t terribly useful, I wanted to include it so you could see how the time() command works, along with the echo command. If you look, there is a single period after the time() function. That concatenates the two items into a single string and displays it all together. If you click the button, you’ll see what I mean.

Bing? How Dare You Load a Microsoft Page!

The Bing photograph of the day is always awesome (Figure 2). Really, Microsoft does a great job of procuring incredible photos, and I love to see them. Since the URL is always different, this was a great way to show how to load JSON into a variable and then extract an array element. Don’t let the scary looking code intimidate you; JSON is really cool. Basically, you load the JSON from that long Bing URL and put it into a PHP array. Then, you form the URL for the photo from the contents of that array. Here’s a snippet of code you can use to see the array in a more readable form:


<?php

$json = json_decode(file_get_contents("http://www.bing.com/
↪HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"), TRUE);

echo "<pre>";
print_r($json);
echo "</pre>";

?>

Figure 2. The Bing photos are always so cool.

If you don’t have a server, head over to here to see the results of the PHP file. You can see where I got the information to build the URL for the image, and in the switch statement, you can see it just loads the image based on that URL. Isn’t JSON cool?

Local Scripts

This part of the switch statement is powerful, but also a little scary. If you click on the “Kernel Name” button, you can see it executes the code in the uname section of the switch statement. Using the shell_exec command, you can execute a file on the local server and show the results in the browser window. This is powerful because it means you can have your family execute local bash scripts by clicking on a button. But it’s a little scary, because you’re executing local commands on your server by clicking a button!

The script is executed with the permission of the web browser, so, for example, in Ubuntu running Apache, the www-data user would be executing the command. If that user doesn’t have permission to do something in the script, the script will fail. This is one of those “with great power comes great responsibility” things. It can be incredibly useful, but also incredibly dangerous, especially if your server is exposed to the internet!

Troubleshooting

Whenever I write PHP code, I make mistakes. Usually it’s a forgotten semicolon or a mismatched bracket. It can be very annoying when you load the page, and it’s suddenly just blank instead of showing you an error. In the last article I wrote about PHP, I showed how to turn on PHP errors so you could see in the web browser what’s going wrong. I don’t do that anymore, because it’s annoying to see PHP warnings when things are working fine. So what I do now is run php from the command line. If the code is broken, it will show errors on your command line, and you won’t have to worry about turning error logging on and off in your web browser. For example, in the example lj.php file, just go to the folder where it’s stored and type:


php lj.php

And the server will dump the HTML to your command line as if it were a web browser. If there’s an error, it will tell you what you did wrong. I like that method of error checking much more than getting error notifications in my web browser, but if you prefer to see them on the browser, look back to my PHP article from the December 2014 issue and see how to activate error logging.

Just like last time, I’m giving you only a taste of the sorts of things you can accomplish with PHP and a little ingenuity. If you come up with an interesting dashboard of your own, I’d love to see it, even if it’s just a screenshot. (Don’t expose your dashboard to the internet, especially if it controls your local server with shell_exec statements!) Feel free to email me at shawn@brainofshawn.com, but be sure to put “DASHBOARD” in the subject line, or I might assume it’s spam. I get so much darn spam!

Unlimited Local Storage for $12 per Month. Really.

I have a 48TB NAS in my basement. Granted, thanks to RAID6 I only (only!) have 36TB of usable space, but still, I assumed that would last me forever. Thanks to ripping DVDs and Blurays, I was so very, very wrong. Rather than spend a few thousand dollars on a new NAS, however, I decided to host my files in the cloud. The storage is unlimited for $12/month, and after 6 months or so, I can tell you it’s a viable alternative to local storage. Plus, it mounts exactly like a local NAS!

The Service

There are plenty of cloud-based storage solutions available, but they are all either very limited in storage space, or very expensive per GB. There is one solution, however, that provides unlimited storage for a set monthly price. Google Drive.

Officially, in order to get unlimited storage, you must get a Business Gsuite with 5 users. Each user is $12/month, and so you’d have to pay $60/month to get unlimited storage. Honestly, $60 a month for that much space is still insanely affordable — but if you open a Business Gsuite account with a single user (so only $12/mo), you still get unlimited storage. It might seem like an error Google would quickly fix, but it’s been that way for years. I’m currently using more than 40TB of space on my Google Drive, and only have a single user on my Gsuite for Business.

The Problem

Google Drive is nice, but let’s be honest, no one wants to use their web interface as bulk storage. It’s clumsy, slow, and as much as I love Google, the organization is confusing at best. Google does provide “Google Drive Stream”, but due to local caching, you still need local storage or you get “not enough space” errors.

Thankfully, Rclone makes direct access to Google Drive seamless. It allows you to create access via keypair (no annoying logging in all the time), and even lets you mount your remote share on your local filesystem. And in true Steve Jobs “one more thing” fashion, it also allows you to encrypt files and directories in real time, so your privacy is protected even if your data is stored on someone else’s hard drive. It’s seriously amazing. And Rclone? Open Source and totally free!

The Process

Rclone is in most Linux distributions, and even has Windows and OSX versions available that all work similarly. In this video, I show you how to quickly set up a share and mount it on the local filesystem. If it seems too good to be true, yeah, I get that. But I’ve been using it for months and I’ve been more than impressed. It’s been reliable, and robust enough to support a handful of users reading and writing at the same time.

You can do a bit of extra work to create your own application API, which will make the performance more robust. It doesn’t cost any extra money, but it’s admittedly a bit of confusing clicking.

The Training?

You probably know I create training for a living. I have more in-depth training on rclone over at CBT Nuggets. If you’re already a subscriber, you can go to https://snar.co/cbt-rclone to get to the skill directly.

If you’re not yet a subscriber at CBT Nuggets, you can see my Everything Linux course overview, which includes my rclone skill and many others. Feel free to sign up for a free trial if you want to view my training. https://snar.co/cbt-everythinglinux

(This isn’t a creepy bait and switch — the free video above really does walk you through the process. There’s just more capability if you’re interested in diving in deeper, and want to check out my professional DayJob training!)

The Done Manifesto

I only recently discovered this tiny bit of brilliance, even though it was written over a decade ago. It’s by Bre Pettis and Kio Stark, and released under Creative Commons, so I’m pretty sure I can post it here without being shady. (I don’t know where to link to originally, because Bre Pettis’ blog from 2009 is no longer live) First, the manifesto:

  1. There are three states of being. Not knowing, action and completion.
  2. Accept that everything is a draft. It helps to get it done.
  3. There is no editing stage.
  4. Pretending you know what you’re doing is almost the same as knowing what you are doing, so just accept that you know what you’re doing even if you don’t and do it.
  5. Banish procrastination. If you wait more than a week to get an idea done, abandon it.
  6. The point of being done is not to finish but to get other things done.
  7. Once you’re done you can throw it away.
  8. Laugh at perfection. It’s boring and keeps you from being done.
  9. People without dirty hands are wrong. Doing something makes you right.
  10. Failure counts as done. So do mistakes.
  11. Destruction is a variant of done.
  12. If you have an idea and publish it on the internet, that counts as a ghost of done.
  13. Done is the engine of more.

The funny part for me is the controversy this seems to spark in people. If this resonates with you (as it does with me, to my very core), it makes perfect sense. It’s not even slightly suggesting a “good enough” attitude, or creating an environment for creating crappy products/results.

This manifesto is for perfectionists who are crippled by a need to make things perfect, or a fear of not being good enough. Or maybe both.

If you worry this list will make you produce mediocre work, this list is not for you.

If following this list seems like permission to do a job half way, this list is not for you.

If you think this list is stupid, and is fluffy nonsense, this list is not for you.

BUT. If this list resonates with your very soul, and reading it gives you the freedom to be as excellent as you truly are but never seem to show, this list IS for you.

Done is better than perfect. And imperfections are what make art beautiful. Don’t rob the world of your creations because they’re not perfect. The world doesn’t need perfect, it needs you. 🙂

PS: I want to buy this poster in the WORST way!

I Am Racist

I don’t want to be. I don’t try to be. My mom didn’t purposefully raise me to be. But I am.

White Privilege. I’m racist because I’m white and I live in a country where that affords me privileges black folks don’t get. Just because I’m white. I don’t want to put white privilege in quotes, because that implies its existence is in debate. It’s not. I have privileges as a white person that others simply don’t have. And yes, I AM ashamed of it. Just because I didn’t seek out my white privilege doesn’t mean it doesn’t exist. And if I “choose” to not use my white privilege, well, I can’t. That’s not how it works. I have plenty of struggles, and I even grew up very poor — but not because of my skin color. Others can’t say the same.

Systemic Racism. I’m also racist because of the systemic racism that still exists in our country. I read a post by a black man who has to walk his tiny little poodle when he wants to go for a walk, because with the tiny poodle, he’s less threatening. That seems absurd. Surely I wouldn’t treat a black man any differently if we passed on the street. But then I thought about it. Would I? If this 6’2″, athletically built black man was walking down the street toward me, would I be nervous? What if he was having a bad day and had a sour look on his face? What if he hated white people? (See? Systemic racism. He MIGHT hate white people, and he might have really good reasons to feel that way. And NO, that’s not “reverse racism”, because there’s just no such thing) I’ve grown up in a bubble, even though I lived in the inner city of Detroit as a child. I was still a white kid in the inner city, so when it came time for me to get a job, I had an easier time simply because I’m white. (Yes, white privilege is part of systemic racism, but I wanted to list them both in bold)

Black Lives Matter. I can not understand why this phrase offends people. It’s not saying or implying that black lives matter more than any other lives. Just that they matter. As much. When we respond, “All Lives Matter” — we’ve missed the point entirely. We can’t erase the disproportionate police brutality by cleverly overwriting the sentiment with inclusivity. Of COURSE all lives matter, but that should include black lives, and the evidence shows it’s not the case. One of my favorite responses to saying “All Lives Matter” is this comic by Kris Straub:

Black People Don’t Need a White Savior. I can’t fix this. I can’t even understand all of it, because of my white privilege. So what should I do? Again, I don’t have all the answers. I know that if we want to make a difference as white people, we should listen to black people. Not so we can fix it, but so we can humbly try to help. I’m a problem solver by nature. I hate that this isn’t something I can fix, but I simply can’t. Hopefully I can be part of the solution.

So to my white friends: No one is mad at you for being white. No one blames you for your white privilege. But denying systemic racism exists is insulting, and a non-starter for moving forward. And honestly, we’re so blinded to the reality, I’m sure I’ve misrepresented things in this very post. Be humble. Acknowledge the disparity. Care. It’s not about us, even if it’s because of us.

My Youngest, Lizzie

To my black friends: You don’t need more burdens, that much I understand. But as a group, we (white people) are so sheltered from reality, we not only don’t know what we should do, we don’t even understand the depth of what’s going on. When white people say, “All Lives Matter”, many of them are trying to be loving and understanding. We want to be better. But we’re spoiled, ignorant, and are used to “fixing” things by snapping our fingers. (GAWD that’s an embarrassing truth) When I see my daughter proudly holding a Black Lives Matter sign while getting scorned by people in big trucks waving confederate flags — I have hope. But even her protest is a cry for guidance. And it’s guidance I can’t give her. Because I don’t know. And my ignorance is embarrassing, but I’d rather be embarrassed and look foolish than be silent and look hateful.

And lastly, to quote my friend Jim Wright, “If you want to be a better nation, be better citizens.”

We Can’t Do This Alone

(NOTE: This is being written during the COVID-19 pandemic, specifically during the “Stay at Home” directive in Michigan.)

My Lungs Suck. Barely.

This week, the CDC announced that it is recommended to wear cloth masks while out in public. A friend of mine kindly made and delivered really cool masks for Donna and me to wear when we go out for walks. You’d think this post was going to be about how my friend Dennis making us masks is how we can work together to get through this. And while that’s true, that’s not what I’m writing about.

Donna and I have been in quarantine for a little over 2 weeks now. It’s because I have health issues that put me at high risk for complications if I get the virus. Today, my health issues really just kicked me in the pants. See, about 3 minutes into our walk, I was reminded just how weak my lungs are. Even with the thin, cloth mask — my lungs were overwhelmed. I had trouble catching my breath, I started wheezing, and my chest started hurting.

Had I not experienced this before, it would have been terrifying. But sadly, I was just reminded that I have never been able to wear masks. When we emptied the hay out of our barn a couple years back, I tried to wear an N95 mask (I also have allergies, hay dust is a monster), and I couldn’t even wear it when riding the tractor. My lungs are just too weak. In fact, even after those couple minutes yesterday, my lungs are still angry today. I just can’t wear a mask.

And that’s the point of this post. Wearing a mask is only a recommendation at this point. I was planning to wear one whenever I go out for a walk, to set a good example. But I can’t. If you can wear a mask, it would be a kindness to people like me. Not even because you might be infected and not know it (you could be), but because wearing a mask is an outward sign that you care about others. Others like me.

I feel bad that I can’t wear a mask. I apologize for the appearance I show of not caring, or not taking the CDC recommendations seriously. But if we all do what we can, we can put the humanity into our society. Be safe. Wash your hands. <3

Isolation Funk

Why are you still at my house? GO AWAY, HUMAN!

I work from home every day. This new COVID-19 stuff shouldn’t be all that different for me. But boy howdy is it ever. Part of it is because I’m in strict quarantine. I’m not going to the store, I’m not meeting anyone at the door, and I’m not even going through drive-thru anything. I’m staying in the house, and going for walks with my wife. That’s literally it.

I’m also a hard-core introvert. I *like* to be alone. But it’s different when you’re alone because you can’t be around other people. There’s something comforting about knowing you COULD go to the coffee shop and sit near human beings if you wanted to. Isolation is oddly painful. Thankfully I have my wife with me, but it’s difficult on her, because while I’m at least partially prepared for solidarity, she’s a social person who actually likes people.

My plan has been to livestream often, upload videos to stay connected with the world, and hopefully help others out of their own funk by sharing our funkiness online. But as the days go on, not only haven’t I had the energy to reach out to the world, I’ve found myself less and less willing and capable to converse even textually. UGH.

I’m doing my best to get past the funk. I’ll even try to post/upload/stream more human stuff as soon as I can muster the strength. I think today I’m going to wire a few new birdcams to get some much-needed nature into my life. I’ll share with everyone, especially once the feeders are live.

Stay strong, everyone. We’re still all in this together, even if we’re apart. Keep eating. Keep showering. Keep shaving (legs or face, or both if you’re into that). And if you’re someone who posts positive things online, keep posting. If you’re someone who follows people who can’t help but post online (ahem, sorry), keep following and commenting.

And of course, wash your hands. 🙂

This is Not Normal Telecommuting

Flamethrowers are standard issue for telecommuters…

Those of us who are work-from-home-introverts can be found online joking about how we’ve been preparing for this Coronavirus thing for our entire lives. And yes, I suspect the transition to working from home will be easier on introverts, and will be almost no change for existing telecommuters. That said, working from home this past week was not normal. Even for those of us who normally work from home.

Some things you might be feeling are normal when starting to work from home:

  • Feeling like you’re not really working because you’re sitting at the same table where you just ate Lucky Charms with your kids
  • Worried that your coworkers think you’re slacking off
  • Mortified at the thought of your kids and/or animals interrupting a meeting
  • Being distracted by being home
  • Feeling alone, so alone, so lonely
  • Having a profound fear that you’re actually a senile old person who is being humored by caregivers into thinking you’re actually doing a job when you’re really just sitting at a table in an old folks home typing on an Etch-a-Sketch and video conferencing at an old photograph of a team building event you attended back in 1982
  • Ok, that last one was just me. Sorry if I’ve introduced that into your own psychosis

Some things, however, are NOT part of the normal transition into telecommuting:

Difficulty Focusing

Don’t get me wrong, it’s easy to get distracted when you work from home. The distractions can be anything from falling into a YouTube hole, to overthinking your interaction with a coworker that seemed like maybe it was tense but you can’t tell because you’re not there to read their body language. Working from home during the Coronavirus is different though.

  • You probably don’t have an established location to work. When you telecommute regularly, you have a work space, even if it is something you set up and tear down every day. After a couple days, you’ll get better at “being at work”.
  • Your kids are probably home with you. This is HUGE. Normally when you work from home, you don’t have your kids with you. During this time of social separation, your kids and possibly spouse are just THERE all the time. That’s not normal, and it’s affecting my productivity as well. And I have a separate office in a remote part of the house.
  • Your company is not prepared to have their entire workforce work from home. As someone who is particularly vulnerable to this virus, I’m grateful and quite honestly proud of companies who are allowing people to work from home. But it’s a sudden adjustment with no time to prep. It will NOT be smooth. It WILL affect productivity. At first, productivity will go down. (That said, I think telecommuting in general is underutilized, and it can help productivity — but this is a special circumstance)
  • YOU ARE THINKING ABOUT COVID-19 ALL THE TIME. And of course you are. So am I. It’s changing the way we live our daily lives. You’re reading this from your kitchen table for Pete’s sake. Our world has been turned bonker-town nutsy-whack. When you’re thinking about if your kid’s cough means he infected Grandma last week, or if you have enough food and toilet paper to stay indoors for a few weeks — it’s going to affect your productivity. Even if you were still in the office. In fact, if you were in the office, and not safe at home, your productivity would probably be even LOWER than it is now.

So basically, welcome to the world of telecommuting. Also, this is not the world of telecommuting. You’re getting a crappy, dystopian version of working from home. When this current emergency is behind us, there might be some changes to how we think about work. There may be opportunities for more employees to transition to telecommuting. Know that while it is a strange adjustment, the weird version you’re experiencing now is not normal. But that’s OK. We’re all in this together, even though we have to be apart. Thank goodness for technology. Hit me up on Twitter or Facebook if you want some social interaction. I’ll even be livestreaming a lot more, just to have a place to spend time together.

Cryptocurrency and the IRS

[NOTE: This is a piece I wrote for Linux Journal a few years back. It’s still very relevant, and still important information for anyone dabbling in crypto. This seems like a good time of year to repost it.]

One for you, one for me, and 0.15366BTC for Uncle Sam.

When people ask me about bitcoin, it’s usually because someone told them about my days as an early miner. I had thousands of bitcoin, and I sold them for around a dollar each. At the time, it was awesome, but looking back—well you can do the math. I’ve been mining and trading with cryptocurrency ever since it was invented, but it’s only over the past few years that I’ve been concerned about taxes.

In the beginning, no one knew how to handle the tax implications of bitcoin. In fact, that was one of the favorite aspects of the idea for most folks. It wasn’t “money”, so it couldn’t be taxed. We could start an entire societal revolution without government oversight! Those times have changed, and now the government (at least here in the US) very much does expect to get taxes on cryptocurrency gains. And you know what? It’s very, very complicated, and few tax professionals know how to handle it.

What Is Taxable?

Cryptocurrencies (bitcoin, litecoin, ethereum and any of the 10,000 other altcoins) are taxed based on the “gains” you make with them. (Often in this article I mention bitcoin specifically, but the rules are the same for all cryptocurrency.) Gains are considered income, and income is taxed. What sorts of things are considered gains? Tons. Here are a few examples:

  • Mining.
  • Selling bitcoin for cash.
  • Trading one crypto coin for another on an exchange.
  • Buying something directly with bitcoin.

The frustrating part about taxes and cryptocurrency is that every transaction must be calculated. See, with cash transactions, a dollar is always worth a dollar (according to the government, let’s not get into a discussion about fiat currency). But with cryptocurrency, at any given moment, the coin is worth a certain amount of dollars. Since we’re taxed on dollars, that variance must be tracked so we are sure to report how much “money” we had to spend.

It gets even more complicated, because we’re taxed on the same bitcoin over and over. It’s not “double dipping”, because the taxes are only on the gains and losses that occurred between transactions. It’s not unfair, but it’s insanely complex. Let’s look at the life of a bitcoin from the moment it’s mined. For simplicity’s sake, let’s say it took exactly one day to mine one bitcoin:

1) After 24 hours of mining, I receive 1BTC. The market price for bitcoin that day was $1,000 per BTC. It took me $100 worth of electricity that day to mine (yes, I need to track the electrical usage if I want to deduct it as a loss).

Taxable income for day 1: $900.

2) The next day, I trade the bitcoin for ethereum on an exchange. The cost of bitcoin on this day is $1,500. The cost of ethereum on this day is $150. Since the value of my 1 bitcoin has increased since I mined it, when I make the trade on the exchange, I have to claim the increase in price as income. I now own 10 ethereum, but because of the bitcoin value increase, I now have more income. There are no deductions for electricity, because I already had the bitcoin; I’m just paying the capital gains on the price increase.

Taxable income for day 2: $500.

3) The next day, the price of ethereum skyrockets to $300, and the price of bitcoin plummets to $1,000. I decide to trade my 10 ethereum for 3BTC. When I got my ethereum, they were worth $1,500, but when I just traded them for BTC, they were worth $3,000. So I made $1,500 worth of profit.

Taxable income for day 3: $1,500.

4) Finally, on the 4th day, even though the price is only $1,200, I decide to sell my bitcoin for cash. I have 3BTC, so I get $3,600 in cash. Looking back, when I got those 3BTC, they were worth $1,000 each, so that means I’ve made another $600 profit.

Taxable income for day 4: $600.

It might seem unfair to be taxed over and over on the same initial investment, but if you break down what’s happening, it’s clear we’re only getting taxed on price increases. If the price drops and then we sell, our taxable income is negative for that, and it’s a deduction. If you have to pay a lot in taxes on bitcoin, it means you’ve made a lot of money with bitcoin!

Exceptions?

There are a few exceptions to the rules—well, they’re not really exceptions, but more clarifications. Since we’re taxed only on gains, it’s important to think through the life of your bitcoin. For example:

  1. Employer paying in bitcoin: I work for a company that will pay me in bitcoin if I desire. Rather than a check going into my bank account, every two weeks a bitcoin deposit goes into my wallet. I need to track the initial cost of the bitcoin as I receive it, but usually employers will send you the “after taxes” amount. That means the bitcoin you receive already has been taxed. You still need to track what it’s worth on the day you receive it in order to determine gain/loss when you eventually spend it, but the initial total has most likely already been taxed. (Check with your employer to be sure though.)
  2. Moving bitcoin from one wallet to another: this is actually a tougher question and is something worth talking about with your tax professional. Let’s say you move your bitcoin from a BitPay wallet to your fancy new Trezor hardware wallet. Do you need to count the gains/losses since the time it was initially put into your BitPay wallet? Regardless of what you and your tax professional decide, you’re not going to “lose” either way. If you decide to report the gain/loss, your cost basis for that bitcoin changes to the current date and price. If you don’t count a gain/loss, you stick to the initial cost basis from the deposit into the BitPay wallet.

The moral of the story here is to find a tax professional comfortable with cryptocurrency.

Accounting Complications

If you’re a finance person, terms like FIFO and LIFO make perfect sense to you. (FIFO = First In First Out, and LIFO = Last In First Out.) Although it’s certainly easy to understand, it wasn’t something I’d considered before the world of bitcoin. Here’s an example of how they differ:

  • Day 1: buy 1BTC for $100.
  • Day 2: buy 1BTC for $500.
  • Day 3: buy 1BTC for $1,000.
  • Day 4: buy 1BTC for $10,000.
  • Day 5: sell 1BTC for $12,000.

If I use FIFO to determine my gains and losses, when I sell the 1BTC on day 5, I have to claim a capital gain of $11,900. That’s considered taxable income. However, if I use LIFO to determine the gains and losses, when I sell the 1BTC on day 5, I have to claim only $2,000 worth of capital gains. The question is basically “which BTC am I selling?”

There are other accounting methods too, but FIFO and LIFO are the most common, and they should be okay to use with the IRS. Please note, however, that you can’t mix and match FIFO/LIFO. You need to pick one and stick with it. In fact, if you change the method from year to year, you need to change the method officially with the IRS, which is another task for your tax professional.

The Long and Short of It

Another complication when it comes to calculating taxes doesn’t have to do with gains or losses, but rather the types of gains and losses. Specifically, if you have an asset (such as bitcoin) for longer than a year before you sell it, it’s considered a long-term gain. That income is taxed at a lower rate than if you sell it within the first year of ownership. With bitcoin, it can be complicated if you move the currency from wallet to wallet. But if you can show you’ve had the bitcoin for more than a year, it’s very much worth the effort, because the long-term gain tax is significantly lower.

This was a big factor in my decision on whether to cash in ethereum or bitcoin for a large purchase I made this year. I had the bitcoin in a wallet, but it didn’t “age” as bitcoin for a full year. The ethereum had just been sitting in my Coinbase account for 13 months. I ended up saving significant money by selling the ethereum instead of a comparable amount of bitcoin, even though the capital gain amount might have been similar. The difference in long-term and short-term tax rates are significant enough that it’s worth waiting to sell if you can.

Overwhelmed?

If you’ve made only a couple transactions during the past year, it almost can be fun to figure out your gains/losses. If you’re like me, however, and you try to purchase things with bitcoin at every possible opportunity, it can become overwhelming fast. The first thing I want to stress is that it’s important to talk to someone who is familiar with cryptocurrency and taxes. This article wasn’t intended to prepare you for handling the tax forms yourself, but rather to show why you might need professional help!

Unfortunately, if you live in a remote rural area like I do, finding a tax professional who is familiar with bitcoin can be tough—or potentially impossible. The good news is that the IRS is handling cryptocurrency like any other capital gain/loss, so with the proper help, any good tax person should be able to get through it. FIFO, LIFO, cost basis and terms like those aren’t specific to bitcoin. The parts that are specific to bitcoin can be complicated, but there is an incredible resource online that will help.

If you head over to BitcoinTaxes (Figure 1), you’ll find an incredible website designed for bitcoin and crypto enthusiasts. I think there is a free offering for folks with just a handful of transactions, but for $29, I was able to use the site to track every single cryptocurrency transaction I made throughout the year. BitcoinTaxes has some incredible features:

  • Automatically calculates rates based on historical market prices.
  • Tracks gains/losses including long-term/short-term ramifications.
  • Handles purchases made with bitcoin individually and determines gains/losses per transaction (Figure 2).
  • Supports multiple accounting methods (FIFO/LIFO).
  • Integrates with online exchanges/wallets to pull data.
  • Creates tax forms.

The last bullet point is really awesome. The intricacies of bitcoin and taxes are complicated, but the BitcoinTaxes site can fill out the forms for you. Once you’re entered all your information, you can print the tax forms so you can deliver them to your tax professional. The process for determining what goes on the forms might be unfamiliar to many tax preparers, but the forms you get from BitcoinTaxes are standard IRS tax forms, which the tax pro will fully understand.

Figure 1. The BitcoinTaxes site makes calculating tax burdens far less burdensome.

Figure 2. If you do the math, you can see the price of bitcoin was drastically different for each transaction.

Do you need to pay $29 in order to calculate all your cryptocurrency tax information properly? Certainly not. But for me, the site saved me so many hours of labor that it was well worth it. Plus, while I’m a pretty smart guy, the BitcoinTaxes site was designed with the sole purpose of calculating tax information. It’s nice to have that expertise on hand.

My parting advice is please take taxes seriously—especially this year. The IRS has been working hard to get information from companies like Coinbase regarding taxpayer’s gains/losses. In fact, Coinbase was required to give the IRS financial records on 14,355 of its users. Granted, those accounts are only people who have more than $20,000 worth of transactions, but it’s just the first step. Reporting things properly now will make life far less stressful down the road. And remember, if you have a ton of taxes to pay for your cryptocurrency, that means you made even more money in profit. It doesn’t make paying the IRS any more fun, but it helps make the sore spot in your wallet hurt a little less.

PoE, PoE+, and Passive PoE

If you’re befuddled by every Poe other than Edgar Allen, after this short blog post, you’ll be confused… nevermore.

I’ve been installing a lot of POE devices recently, and the different methods for providing power over Ethernet cables can be very confusing. There are a few standards in place, and then there’s a method that isn’t a standard, but is widely used.

802.3af or Active PoE:

This is the oldest standard for providing power over Ethernet cables. It allows a maximum of 15.4 watts of power to be transmitted, and the devices (switch and peripheral) negotiate the amount of power and the wires on which the power is transmitted. If a device says it is PoE-compliant, that compliance is usually referring to 802.3af.

802.3at or PoE+:

The main difference between PoE and PoE+ is the amount of power that can be transmitted. There is still negotiation to determine the amount of power and what wires it’s transmitted on, but PoE+ supports up to 25.5 watts of power. Often, access points with multiple radios or higher-powered antennas require more power than 802.3af can supply.

Passive PoE:

This provides power over the Ethernet lines, but it doesn’t negotiate the amount of power or the wires on which the power is sent. Many devices use Passive PoE (notably, the Ubiquiti line of network hardware often uses 24v Passive PoE) to provide power to remote devices. With Passive PoE, the proprietary nature of the power specifics means that it’s often wise to use only power injectors or switches specifically designed for the devices that require Passive PoE. The power is “always on”, so it’s possible to burn out devices if they’re not prepared for electrified Ethernet wires, or if the CAT5 cabling is wired incorrectly.

Figure 1. This AP requires a Passive PoE 24v supply. It can be confusing, because even though it says it’s PoE, it won’t power on using a standard 802.3af switch.

The best practice for using power over Ethernet is either to use equipment that adheres to the 802.3af/at standards or to use the power injectors or switches specifically designed for the hardware. Usually, the standard-based PoE devices are more expensive, but the ability to use any brand PoE switch and device often makes the extra expense worthwhile. That said, there’s nothing wrong with Passive PoE, as long as the correct power is given to the correct devices.