Skip to content


Quick Tip: Install hub for GitHub on Ubuntu

Yesterday I was automating updates between GitHub repos via CI, and I wanted to automatically open a PR against a repo. GitHub’s hub CLI is the perfect, obvious candidate. But how do you easily install it in Ubuntu?

A long “one-liner” to download and install a specific version of hub as a pre-compiled binary:


curl -Ls https://github.com/github/hub/releases/download/v2.11.1/hub-linux-amd64-2.11.1.tgz | sudo tar -xvz -C /usr/bin --strip-components=2 hub-linux-amd64-2.11.1/bin/hub && sudo chmod 755 /usr/bin/hub

If you don’t mind running a development version, and you have go installed, you can just run


go get github.com/github/hub

But you’ll need to add $GOPATH/bin to your $PATH to easily use it.

Posted in Tech Reference.


Handling Extra Income When Pursuing Financial Independence

The funny thing about increasing your income in a household that’s pursuing Financial Independence is that it works so differently than other households.

If you start a side hustle that earns an extra $500/month, normally you may think “I’m already hitting my savings goals, so I’m free to spend this ‘bonus’ money however I please!” However, because you’re aiming for FI within a certain timeframe, you have to think about the relationship between saving and spending.

Basically, they play out like this: Continued…

Posted in Personal Finance.


Quick Tip: Extract Data from Highcharts

Have you ever looked at a chart on a website and you want to export the raw data? Maybe you even poked around Chrome Developer Tools and realized it’s not coming via an API. But you did notice they’re using Highcharts? You’re in luck!

Just open up the Developer Console and grab the data series you want directly. Let’s say that the chart has 4 lines, but you only want the first series. (Generally this is the first series in the legend, or you can just experiment until the numbers match those you see in the graph.)


values = [];
Highcharts.charts[0].series[0].data.forEach(function(d){ values.push(d.y) });
console.log(values);

That’s all!

Posted in Tech Reference.


The New 2018 Tax Law and You

The internet is full of discussions about the new tax law that went into effect for 2018. In particular, people seem to really dislike the new $10,000 cap on State, Local, and Property Tax deductions. The thinking is that this amounts to “double taxation” on anything over the cap, and that’s just not right.

But we should put this in context of the full changes to the tax code. The standard deduction was also increased substantially and, in general, marginal tax rates went down.

So let’s cut through the hyperbole and run some numbers. How does this actually affect your life? In particular, how much Federal tax do you have to pay in 2018 relative to what you paid in 2017?

An email from my friend’s father on this topic stated:

[I’m concerned about] the impact on double taxation in the high income states and locations that have higher real estate taxes.  I have a friend whose income is probably around $200,000 per year, so even assuming that his deductions take him to a reasonable AGI – he probably has around $2500 in state income taxes and his home has $14,000 in Real Estate Taxes (County, Local & School) – so under the new tax law he will pay federal taxes on $6,500 of this $16,500 in SALT [State and Local Taxes].

We’ll use this friend as an example here. We’ll call him Bob. Since Bob owns a home with $14k in property taxes, I’m assuming he’s married and has kids in a good school district. Because he only mentions Bob’s income, I’ll assume that Bob’s wife is a stay-at-home mom. So that $200k is their combined household income.

Continued…

Posted in Commentary, Personal Finance.


Personal Capital’s Tactical Weighting Approach

Last week I had the free Personal Capital consultation. My “advisor” had run a portfolio analysis based on my aggregated information in the PC dashboard for me and wanted to share the results. I was a bit intrigued with their so-called “Tactical Weighting” portfolio allocation approach and wanted to discuss it here today.

Personal Portfolio Review

To set the stage for the need for Tactical Weighting, let’s discuss a few things that my advisor highlighted as a bit worrisome:

  • cash holdings: I’m holding too much cash for my risk profile, both within investment accounts and in savings
  • geographic concentration: I’m almost entirely invested in U.S. equities (besides cash and real estate holdings)
  • sector concentration: I’m heavily weighted toward technology and financials
  • market-cap concentration: I’m heavily weighted towards the largest of U.S. companies

Continued…

Posted in Commentary, Personal Finance.


Fastest way to un-cap a MongoDB capped collection

A couple of weeks ago I converted a mongodb collection to a capped collection. This is for an event archive which we only need to keep the last month of events stored locally. The issue is that this data grows unbounded for a long time until we manually free up disk space. Enter capped collections, which create a fixed-size collection by automatically removing the oldest documents. Unfortunately, I didn’t realize that our application would also update existing documents. Updates which cause a document to grow will fail. Bummer.

Now we need to rollback to uncapped collections and find another way to manage the database size (ahem, cron job). The recommended approach using “copyTo(…)” is deprecated in newer versions and agonizingly slow for a large 100GB+ data set in older versions. (This database was still running 2.4. I know.)

For a basic benchmark, using “copyTo(…)” took about 10 hours to copy ~80% of a 100GB capped collection. Continued…

Posted in Tutorials.


Restricting uploads to public PyPI

Many companies use an internal PyPI server for storing their proprietary python packages. This makes managing python libraries and application dependencies so much easier. But unfortunately this also makes it easy for people to accidentally upload their private code to the public PyPI unintentionally.

Lucky for us, there’s a cool extension to setuptools called restricted_pkg! Unlucky for us, it leaves something to be desired in terms of user experience. Let’s say we have an example library called xl which uses restricted_pkg to prevent accidental uploads. Continued…

Posted in Tutorials.


AWS User Policy for Single S3 Bucket

A common requirement is to have a backup service or script that uploads objects to S3 for storage. Since its good practice to scope user permissions as narrowly as possible, this leads to creating separate “api users” in Amazon for each service. Each user is only given permission for the buckets it needs to access. Unfortunately, the Resource URIs for AWS are non-intuitive and you have to remember to whitelist both the bucket and its contents. If you’re kind, you’ll also allow listing all buckets to make navigating through the UI or other tools possible.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::some-bucket-name",
                "arn:aws:s3:::some-bucket-name/*"
            ]
        }
    ]
}

#protip #selfreference

Posted in Tutorials.


How To See A Process’s Environment in Linux

One of our sysadmins recently taught me that we can see the environment with which a process is launched by looking in /proc. Whoa! That’s helpful.

Unfortunately, the environment file is null terminated so not pleasant to read or pipe together with other commands. So here’s a handy one-liner to print them “properly” for easier inspection or command chaining.

cat /proc/{pid}/environ | xargs --null --max-args=1 echo

#protip #selfreference

Posted in Tech Reference.


How Much Does Tax Deferral Save You?

Ever wondered exactly how tax deferral saves you money? Although deferring your income is often cited as a “good thing”, the most common explanation given is a tax arbitrage between your current tax rate and a presumably lower tax rate in retirement. Many people even go so far to say that if your tax rate is the same in retirement then its equivalent, excluding the time value of money. Let’s see if this is actually true.

I’ve put together a small scenario which compares a one-time contribution to a deductible Traditional IRA to a standard investment account (non-tax-advantaged) which is then allowed to grow for the next two decades.

Tax Deferral Advantage

Wow! We realized a 31% gain using a tax-deferred investment option given the same tax rate! (30% in this example)

So how does this deferral advantage change with different tax rates, investment returns, and holding periods? Continued…

Posted in Personal Finance.




Log in here!