vij update

Vij is a bash function that makes editing specific files easier to find in a deeply nested directory structure. At the time I was working in Java which is notorious for having a deep directory structure. In 2008, I updated vij to be more powerful by offering a list of files matching the name, giving you the option to make a choice.

Our current project is in Golang and I’ve found a deficiency in vij. We have a vendor directory which contains our dependencies and sometimes vij will find files in the vendor directory which I don’t want to edit. It would be nice to exclude a directory from the find command used by vij.

I always want to ignore the vendor directory. But I also want to allow arbitrary names to also be filtered out. The existing vij implementation results in the following crazy output.

$ vij util.go

Multiple matches found...
1: ./pkg/broker/util.go
2: ./pkg/fusortest/util.go
3: ./vendor/
4: ./vendor/
5: ./vendor/
6: ./vendor/
16: ./vendor/
108: ./vendor/
q: Quit


I just want to see the util.go files in my code tree and ignore all of the ones in vendor. I changed the dafiles variable to have two more options. One is always ignore vendor from the normal use case, but also allow the user to pass in a string to filter on.

    if [ "$3" == "" ]; then
        dafiles=$(find . -type f -name "$2" -not -path "*/vendor/*")
        dafiles=$(find . -type f -name "$2" | grep -v $3)

Now when I run vij util.go, vij ignores the vendor directory.

$ vij util.go

Multiple matches found...
1: ./pkg/broker/util.go
2: ./pkg/fusortest/util.go
q: Quit


Let’s say I want to find all files named User*.java but not the ones in the test directory. You can simply supply “test” as the second argument to vij.


$ vij User*.java

Multiple matches found...
1: ./src/main/java/org/candlepin/auth/permissions/
2: ./src/main/java/org/candlepin/auth/permissions/
3: ./src/main/java/org/candlepin/auth/
4: ./src/main/java/org/candlepin/auth/
5: ./src/main/java/org/candlepin/model/
6: ./src/main/java/org/candlepin/model/
7: ./src/main/java/org/candlepin/resource/
8: ./src/main/java/org/candlepin/service/
9: ./src/test/java/org/candlepin/auth/
10: ./src/test/java/org/candlepin/auth/permissions/
11: ./src/test/java/org/candlepin/model/
12: ./src/test/java/org/candlepin/resource/
q: Quit



$ vij User*.java test

Multiple matches found...
1: ./src/main/java/org/candlepin/auth/permissions/
2: ./src/main/java/org/candlepin/auth/permissions/
3: ./src/main/java/org/candlepin/auth/
4: ./src/main/java/org/candlepin/auth/
5: ./src/main/java/org/candlepin/model/
6: ./src/main/java/org/candlepin/model/
7: ./src/main/java/org/candlepin/resource/
8: ./src/main/java/org/candlepin/service/
q: Quit


Here’s the full implementation of the updated vij:

# reused by other commands that require a filename
__dafiles ()
    if [ "$3" == "" ]; then
        dafiles=$(find . -type f -name "$2")
        #dafiles=$(find . -type f -name "$2" -not -path "*/vendor/*")
        dafiles=$(find . -type f -name "$2" | grep -v $3)
    matches=$(echo $dafiles | gawk '{print NF}')

    case "$matches" in
           echo "No matches found"
           echo "Multiple matches found..."
           for option in $dafiles
              echo "$i: $option"
              i=`expr $i + 1`
           echo "q: Quit"
           read -p "? " ans
           if [ "q" == "$ans" ]; then
              show=$(echo $dafiles | gawk '{print $'$ans'}')

    if [ "" != "$show" ]; then
       $cmd $show

vij ()
    __dafiles "vim" $1 $2


Looking back through the past elections going back to the 1980 election of Reagan, I noticed something about the winners. All but one had charisma. Despite some candidates being more capable and experienced. The charismatic candidates were better able to rile up their voters to get them to come out and vote, coupled with particular pains felt by those particular voters.

Let’s take a look at the elections:

1980: Reagan vs Carter (incumbent)

We had an oil shortage, inflation was high, coupled with high unemployment. Trouble abroad with Iran (hostages), and some other factors. Reagan was a masterful orator and could communicate with the masses. He gains the nickname, “Great Communicator“. He is able to get everyone on his side, wins in a landslide 489-49 electoral votes. Charisma wins.

1984: Reagan (incumbent) vs Mondale 

The economy is doing better for some, I still heard rumblings of tough times from the lower middle class. AIDS epidemic is front and center in the news. The First Lady, Nancy, is out and about with say no to drugs campaign. Mondale is not a very exciting candidate and things weren’t “feeling” so bad for the incumbent president. But it is hard for Mondale to compete with the charisma of Ronald Reagan, being obliterated in the general election 525-13.  Charisma crushes it.

1988: Bush (HW) vs Dukakis

Ok this is the one election that I felt wasn’t really affected by charisma of the candidates. I mean Dukakis was short and didn’t have the “look” people wanted in a president. Bush is actually quite boring but he gets to ride on the coat tails of a hugely successful and charismatic Reagan. I used to say the Republicans screwed themselves when they passed the two-term limit amendment to prevent another FDR. I think Reagan would’ve easily won a third term. I guess they were protecting themselves from a possible third Clinton or Obama term in the future 🙂 I digress, Bush goes on to win 426-111. We have two pretty boring candidates, for this argument I will give Bush the charisma points. Charisma wins again.

1992: Clinton vs Bush (HW) (incumbent)

Ah my first election, I missed being able to vote in 1988 by a measly one year. So I was excited to begin the process of being able to vote. We’ve entered a new decade. Just coming off the Gulf War, some folks are upset that we went to war. Oil prices spiked in 1990 still fresh in minds. People are still talking about trickle down and supply side economics from the 80s not working for them. A charismatic southern democrat, Bill Clinton. He found a way to engage the young voters. He’s able to charm folks to a win over the incumbent President Bush. Clinton wins 370-168 even with a third party candidate in the mix. Charisma for the win.

1996: Clinton (incumbent) vs Dole

The economy is booming, the internet is opening to public, and gas prices were low, good ole $1 for a gallon. The Dow Jones was hovering in the 5000, by election time it had risen above 6000. Personally, just graduated college in 1995, got a good paying job as a software engineer. The administration wasn’t doing as well publicly though. Despite the scandals happening at the time, like the Lewinsky scandal, Clinton marches to a decisive 379-159 win over the experienced but less charismatic, Dole. Charisma 5 for 5 so far.

2000: Bush (Dubya) vs Gore

The new millennium. We survived the doom and gloom of the Y2K bug where the entire internet was going to just shutdown because of storing years as 2 digits instead of four, nothing happened 🙂 The Dow Jones is well into 10000.  Tech is moving a faster pace: Google, founded in 1998 and  Amazon, founded in 1994, are both thriving. This is the year I got married, relocated to North Carolina, got a new job, and bought our first house all in the span of 4 months. So the Clinton/Gore administration policies were serving me just fine. The rest of the country didn’t seem to agree with me, well they kind of did.  This would’ve been another case where the 22nd amendment hindered a possible third term, Clinton was still quite popular, with an approval rating of low to mid 60s. Despite his approval ratings, Gore was very boring. He was intelligent and a statesman but just bleh. In comes a cowboy, a president you could have a beer with, but has the rough and tough charisma people think we need. This was a devastating election because it was so hotly contested when CNN announces it for Gore only to retract it because of discrepancies in Florida. Ultimately, Bush wins the election 271-266. Cowboy charisma wins over boring statesman.

2004: Bush (incumbent) vs Kerry

Just 3 years after the worst attack on American soil, we are at war in Afghanistan and Iraq. The economy isn’t fairing very well, after the dot com bust. Gas prices are rising, finally hitting $2. Bush has a pretty high approval rating, in the 60s, coming off his first term and his handling of September 11th. Remember, Bush was the cowboy. We put up John Kerry to be the opposing candidate. Kerry was a skilled politician, but not charismatic at all. He added John Edwards to his ticket which helped a little, but not enough to overcome the cowboy charisma of Bush. Bush wins 286-251. Charisma 7, boring 0.

2008: Obama vs McCain

In 2008, we are all annoyed at the high gas prices rising well past $3/gallon. Ravaged New Orleans by Hurricane Katrina which was hugely mismanaged, and Bush was blamed for it. The economy is doing poorly still reeling from the dot com bust and in the midst of what folks termed, The Great Recession. A young charismatic African-American, Barack Obama, rises from the Democratic party to round up millennials and minority groups with an easy to remember slogan: Yes We Can. Contrast this to McCain which many liberals seemed to like except when he was running for president, he became a different person to appeal to his base. He wasn’t very charismatic, which he tried to offset with his running mate, Palin. These two could not be more opposite. Obama wins 365-173 to become the first African-American president.

2012: Obama (incumbent) vs Romney

Two years after the Patient Protection and Affordable Care Act passes, people are upset at being forced to get health care. The administration bailed out the auto industry, bailed out Wall Street, gas prices are still in the upper $3. But the economy has survived, the Dow Jones hit a low of 6627 in 2009. By 2012, it had rebounded back to 13000. Romney was a capable candidate, especially compared to Bush from 2000. He was a successful governor, he would’ve been a capable president. Romney was missing one thing, charisma. He was no match for Obama’s charismatic speeches. Obama wins the 2012 election, 332-206.

2016: Trump vs Clinton (Hillary)

We finally hit the present. Gas prices are back into the low $2 range. The Dow Jones has climbed above 18000. This was an election purely based on charisma. Donald Trump is able to rile up his base to get people voting. He did it in a different manner, a pretty nasty bully but behind all the nasty things he said, he did have a message that many folks heard. But the Democrats thought that an experienced candidate that could maneuver the intricacies of the presidencies would be enough to win. We missed one aspect, Hillary Clinton was a dud from a personality point of view. She always seemed fake, tried to hard to empathize and I believe that was truly her undoing. Trump wins 306-232. Charisma wins yet again.

I’m extremely disappointed in the outcome of this years election. I still believe that Hillary Clinton was a more qualified candidate. I think she would’ve been tougher than any man could ever hope to be. She would’ve been a hawk in the Oval Office. She just couldn’t convince the people of that, which is equally important.

I firmly believe it doesn’t matter how much you know and how capable a leader you could be, if you lack personality you will NOT win the presidency. You need to have the charisma to be able to rile up your voters in order to increase your turn out. That’s really all it takes now, in this age of social media.

Looking forward to 2018 mid-terms and 2020! I just pray to God that Trump doesn’t destroy everything before then.

Pretty Print directory of .json files

I had a bunch of compressed json files that I needed to pretty print to make them more readable. This little snippet will create a new pretty printed json file prefixed with pp:

ls *.json | xargs -I {} sh -c "cat {} | python -mjson.tool > pp{}"

Instead of having to look at files that look like this:

{ "attributes": [ { "name": "type", "value": "PKT" }, { "name": "arch", "value": "x86_64,x86" }, { "name": "name", "value": "Awesome OS" } ], "dependentProductIds": [], "href": "/products/00", "id": "00", "multiplier": 1, "name": "Awesome OS", "productContent": [ { "content": { "arches": null, "contentUrl": "/content/6/$releasever/$basearch/debug", "gpgUrl": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-awesome-os", "id": "FFFF", "label": "awesome-os-debug-rpms", "metadataExpire": 86400, "modifiedProductIds": [ "0A" ], "name": "Awesome OS (Debug RPMs)", "releaseVer": null, "requiredTags": "awesome-os-server", "type": "yum", "vendor": "Candlepin" }, "enabled": false } ] }

You get a bunch of files that look like this:

    "attributes": [
            "name": "type",
            "value": "PKT"
            "name": "arch",
            "value": "x86_64,x86"
            "name": "name",
            "value": "Awesome OS"
    "dependentProductIds": [],
    "href": "/products/00",
    "id": "00",
    "multiplier": 1,
    "name": "Awesome OS",
    "productContent": [
            "content": {
                "arches": null,
                "contentUrl": "/content/6/$releasever/$basearch/debug",
                "gpgUrl": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-awesome-os",
                "id": "FFFF",
                "label": "awesome-os-debug-rpms",
                "metadataExpire": 86400,
                "modifiedProductIds": [
                "name": "Awesome OS (Debug RPMs)",
                "releaseVer": null,
                "requiredTags": "awesome-os-server",
                "type": "yum",
                "vendor": "Candlepin"
            "enabled": false

Cold but fun day

Today was a cold but fun day. We started the day with Iliana’s 8:30am softball game (they won 8-5). Adan had a pitching lesson at 10:45am where he has improved his fastball and change up pitches. He worked on his curve and some pickoff move all while battling cold, wind and what felt like a sandstorm from the field. Home for about 2 hours to eat lunch and warm up before heading out again, this time for Marco’s 2:30 soccer game. The won that game 5-1 with some outstanding ball movement. Still frozen, we weren’t done yet. Off to Marco’s baseball game. His team won that game, but the best part was Marco hit a SOLO HOME RUN over the centerfield fence. It was AWESOME! We finished the evening with dinner at Chipotle and watched Star Wars the Force Awakens when we got home.

Installed rear shocks on Mazdaspeed

We had a rare free day this weekend, usually they’re filled up with softball, baseball and/or soccer games. I took the free day to do some car maintenance. I’m in desperate need of new shocks and struts, already ate through one set of tires. Saturday I replaced the rear shocks. It took me 4 hours, taking pictures and reading instructions that came with the parts.

It’s pretty difficult finding parts for the Mazdaspeed version of the Mazda 3, it’s either OEM parts from the Mazda dealer which is clearly $$$, or it’s some performance parts. I was trying to balance price with performance, so I ended up with the Corksport adjustable shocks and struts. They are the cheapest yet still offer some level of performance. I really wanted to get the spring combo but that was another $200.


Why not take it to a shop? Well the last 2 quotes I got were about $250+ in labor for the rear shocks. That’s too rich for my blood especially for removing 4 bolts. Here’s a high level description of what I had to do, see the Corksport site for detailed instructions and be sure to checkout the Mazdaspeed forums for advice as well.

  1. Raise vehicle onto jack stands, since you’ll need the jack for a later step IMG_0691
  2. Use the floor jack on the lower control arm to compress the rear spring, and to alleviate pressure on the shocks.IMG_0701
  3. Use a 17mm socket to remove the lower bolt of shock  IMG_0693
  4. Use a 12mm deep socket to remove the two nuts holding the top mount in place.IMG_0697
  5. Now you need to manually compress the shock to allow it to clear the lower bracket in order to be removed from the vehicle.
  6. Once removed, used a 13mm socket to remove the nut holding the aluminum mount to the shock. I had to use a pair of vise grips to hold the shock bolt from moving while removing the nut. The stock bump stops were shot.IMG_0704

That is the standard removal steps. Now the rest are Corksport specific. For the Corksport shocks you only need to keep the aluminum mount.

  1. Retain the stock aluminum mounts, remove the stock bump stops (they’re probably trash anyway), and the stock dust cover.
  2. Place the aluminum mount onto the Corksport shock. You will notice there isn’t much bolt that comes through the mount. This took me a while to figure out. Press the mount down onto the shock, you might have to compress the shock, then put the nut on the bolt and start turning until it latches. This took a bit of pressure and patience. Tighten the nut to 18 lb-ft of torque.
  3. The bump stops pre-installed on the Corksport shocks will compress to allow you to properly torque down the nut and install the mount.

At this point the old shocks will have been removed, the new ones have the mounts installed, and you are ready to install the new ones on the vechicle.

  1. Manually compress the shocks so you can get the shocks into the wheel well.
  2. Insert the top mount onto the 2 mounting bolts.
  3. Align the bottom to the lower bracket. You have 2 options here.
    1. Let the bottom go through the bracket to be compressed by hand later
    2. Keep the shock compressed while you insert the 17mm bolt to hold the bottom of the shock in place.IMG_0702
  4. Install the 12mm nuts on the top mounting bolts. Torque them down to 18 lb-ft.
  5. Now install the 17mm bolt on the bottom and torque it down to 50 lb-ft.
  6. Lower the floor jack to relieve the pressure on the spring.
  7. Re-install the tire and you’re DONE! IMG_0699 IMG_0698
  8. Repeat for the other side.

Now I need to replace the front struts. Those are not as trivial since they involve compressing the springs on the strut, and lot’s of penetrating oil. We’ll see if $250+ is worth it for the front or if I feel inspired to do this myself.

Happy 14th Birthday Adan!

Today we celebrate Adan’s 14th birthday. He’s grown a lot both physically and mentally 🙂 He’s becoming quite a wonderful young man.

Here he is having fun with some sunglasses I got from work.


His baseball jersey.


Soccer player

Marco’s been super busy playing soccer with both his middle school team and his club soccer team. He’s not getting a lot of playing time on middle school during the conference games which he expected being one of the few 7th graders on a team full of 8th grade veterans. But his club soccer team hasn’t been playing him as often as he wanted despite working equally hard.

So to hopefully cheer him up and keep up his spirits I write him a poem, I guess you can call it a poem. At 5:40am I came up with this (I revised it a bit to add more).

Soccer Player by Jesus Rodriguez

When I’m on the bench, I do not feel fine.
I’m not a bench warmer, I’m putting in time.

When I play defense, I will be agile and fast.
When I play defense, nothing will get past.

When I play offense, I will not bore.
As the offense, I will shoot and score.

As the goalie, I will block all.
Because as the goalie, I am a brick wall.

Nothing will cause dismay.
Because soccer is what I play.

Snow removal

Lot’s of folks complain that the south doesn’t know how to deal with snow. We don’t know how to drive in it. We don’t know how to work in it. We don’t have snow trucks, well not many and most are in the mountains. But we do know how to get rid of the snow, we let the Sun take care of it 🙂

This morning at 9 am both the front and backyard had plenty of snow covering it.



By 12:30pm, it was pretty much all gone.



I think we’re ready for the snow now 🙂 Bring it!