Travel Day

July 11, 2017

Travelling today. Looks like 13 hours door to door.

Continue reading →

Update Last Git Commit Comment

July 10, 2017

You just committed to your Git repo and realized you have a typo in your commit message. Here is how you can edit the last commit's comment.

$ git commit --amend

Continue reading →

Git Reset Hard

July 9, 2017

Here is how you can backup one commit in Git. The situation is where you've just committed to a branch and want to backup and throw this recent commit away.

Get the SHA of the previous commit then git reset hard to it.

For example,

$ git reset --hard 2acdd9bcdbd71a4ee919c90c0e964778346c54d1

Continue reading →


July 8, 2017

4Clojure is a site which offers 156 exercises to learn Clojure by solving some sort of programming challenge. The exercises are grouped from Elementary, Easy, Medium to Hard. For each you are presented with an explanation and a set of test cases which when run with your entered function must pass.

I decided to mention 4Clojure today because I've gotten back to it and am trying to finish the last few problems. I can say at this point the Hard problems are in fact Hard.

I highly recommend trying to get through as many of the 4Clojure exercises as you can if you are an aspiring Clojurist.

Continue reading →

Insert Org Mode Line

July 7, 2017

If you use org-mode a lot you'll eventually look to a way to quickly setup a new file with your favorite settings. Here I use the following to quickly add the org mode line and a few favored settings.

(defconst *org-modeline*  "# -*- mode:org; -*-")
(defconst *org-mode-settings* "
#+STARTUP: showall
#+STARTUP: hidestars
#+OPTIONS: toc:nil
#+OPTIONS: skip:t
#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"./org.css\" />
#+OPTIONS: ^:nil


(defun insert-org-modeline ()
    (insert *org-modeline*)
    (insert *org-mode-settings*)

Feel free to add or modify to make the above your own.

Continue reading →

Function update-work

July 6, 2017

I've had a long time practice of putting all my projects in their own repositories and keeping them in a work directory under my home directory. I even start repos for personal projects as well as various of interest items. Smaller lists and plans go into more general repos and everything is organized and backed up in a source control system.

With this I've ended up creating various functions to help manage things. For example, the following update-work bash function goes through my work directory and runs the git status command in each directory which is a git repo.

function update-work {
    pushd "$HOME/work"
    for f in `find . -maxdepth 2 -name .git`
        echo "--------------------------------------------------"
        echo "REPO: $f"
        pushd "${f%/.git}"
        git status
        echo "--------------------------------------------------"

Continue reading →


July 5, 2017

Whenever I need to look at a Git repository in a visual way I pull out GitX. Today, I thought to mention it in case anyone is looking for a Git gui for the Mac.

I've used GitX for a number of years and have yet to find a reason to try anything else.

Continue reading →

Tokenwatch (Part 2)

July 4, 2017

Once part 1 of TokenWatch was done the next step appeared when you saw all the details on each entries interior page. There I was most interested in the links to the Whitepapers so I could collect them and read through them more easily as a group.

For this part of the project I created another script which extends the previous script.


To start I'll be getting the dataframe from the script sorted by NAME.

df = t.process().sort_values(['NAME'])

Each row in the dataframe has a link to the details page. The gist here will be to get this page and parse out the details I need. When inspecting the page it is noted that all the tables are classed with table-asset-data. The last one on the page is the most interesting. To grab that table see the following.

    html = requests.get(url, headers={'User-agent': 'Mozilla/5.0'}).text
    soup = BeautifulSoup(html, "lxml")
    tables = soup.findAll("table", {"class": "table-asset-data"})
    # Last table
    table = tables[-1]

For convience I grab the tables data into a dictionary.

    details = {}
    for td in table.find_all('td'):
        key = td.text.strip().split(' ')[0].lower()
        vals = td.find_all('a')
        if vals:
            value = vals[0]['href']
            value = '-'
        details[key] = value
    return details

Continue reading →

Tokenwatch (Part 1)

July 3, 2017

Continuing with my research into tokens and blockchain assets I found another site called This site includes ICOs which are running as well as upcoming campaigns.

In a similar fashion as previous post ( I decided to scrape the site so I could group the entries by status more easily. The result of this is a Python script called

The following are some highlights to get the script working.

Table Data

When you inspect the page at you'll find the data is in a table identified by a class of table-assets. To use requests and BeatifulSoup you can use the following function.

def get_table():
    url = ''
    html = requests.get(url, headers={'User-agent': 'Mozilla/5.0'}).text
    soup = BeautifulSoup(html, "lxml")
    table = soup.select_one("table.table-assets")
    return table

Each row in the table has a set of td cells. I'm interested in the details page link, the status, project name, symbol and description. To get these see this function.

def get_data(tds):
    link = tds[3].find("a")['href']  # tds[1].find("a")['href']
    status =  tds[2].text.strip().replace(u'\xa0', ' ')
    name =  tds[3].text.strip().split("\n")[0]
    symbol =  tds[4].text.strip()
    description =  tds[5].text.encode('ascii', 'ignore').strip().replace('\n', '')
    return [symbol, name, status, description, link]

It is most useful to get the data into a Pandas DataFrame.

Continue reading →

Gist mode issue

July 2, 2017


Recently, I recommended using gist.el to work with your Gists on GitHub. I found an issue with gist.el in the version installed here.

I was having trouble editing the description of the gists with the e command.

e               gist-edit-current-description

The error that was returned was:

byte-code: Invalid slot type: gh-gist-gist, id, string, nil

The latest version of gist.el is 1.4.0 fixes the issue but here I see only 1.3.1 in my package list.

  gist               1.3.1         available  marmalade  Emacs integration for

So, I decided to manually install gist.el and it's dependencies.

Installing from git

Continue reading →

Coin Market Cap

July 1, 2017

There is a useful page called CryptoCurrency Market Capitalizations for viewing the current state of the crytocurency markets.

The site shows all currencies runing today on a number of platforms. I'm interested in the ones running on Ethereum which have a Market Cap. Since, the site doesn't have this specific filtering capability I thought it would make a good project to grab the data from the page and filter it the way I'd like.

To do this I decided to investigate Pandas and it's read_html function for pulling data in from html tables.

The following are notes for a Python script that I wrote to pull data from the CryptoCurrency Market Capitalizations, massage the data and show it in useful formats.


Setup a virtualenv with the following libraries.


Read Table

Continue reading →


June 30, 2017

For testing it is sometimes of interest to have a web service which returns OK for anything that is passed to it much like the null device in Unix. In Unix you can open open the /dev/null device and write to it. It is an empty file that accepts all data written to it without storing the data.

For a web service to act in a similar fashion it would run and accept anything passed as a parameter in urls passed to it.


How could such an application be built in Clojure? One way would be to use HTTP Kit and have it return OK for anything that is passed to it.


Add http-kit to your project.clj file.

 :dependencies [
                 [http-kit "2.2.0"]

Then you'll want the most basic of handlers. This returns OK for any request that is passed to it.

(defn handler [req]
  {:status 200
   :headers {"Context-Type" "text/html"}
   :body "OK"})

Continue reading →

Bump Version

June 29, 2017

A script to bump the version number in a pom.xml file.


# A script to bump the version number inside a pom.xml file

if [ -z "$1" ]
    echo ""
    echo "Bump version script for incrementing the version number in a project's pom.xml file."
    echo ""
    echo "Usage: bump-version 'version-string'"
    echo ""
    echo ""

echo $VER

# enure we have a value 
CMD="mvn versions:set -DnewVersion=$VER"
echo "Executing:"
echo $CMD

mvn versions:set -DnewVersion=$VER

echo "done"

Continue reading →

Diff Heroku Configs

June 28, 2017

Here is a script that was created to diff the configurations between two Heroku apps. This came about when configuring and testing a development and a production Heroku system. In this case you want to know how they differ.



CMD="diff <(heroku config --app $APP1) <(heroku config --app $APP2)"
echo $CMD

eval $CMD

Continue reading →

Car Rental Fees And Taxes

June 27, 2017

It looks like fees and taxes for car rentals is out of control. Anyone notice? Here is an example.

I wanted to rent a car for two weeks so I shopped around. It looks like for a car it would be about $360 dollars a week that totalled specifically to $729.30 for two weeks.

Click the button to finalize and the total is $1046. What? There is $317 dollars in taxes and fees. Nearly the price of a week's rental.

| Compact Suv                       |       |  729.30 |
| Unlimited Mileage                 |       |         |
|                                   |       |         |
| TAXES & FEE                       |       |         |
| Consolidated Facility Chg 6.00/Dy | 84.00 |         |
| Concession Recovery Fee 11.11 Pct | 81.77 |         |
| Wa State Rental Tax 5.9 Pct       | 48.25 |         |
| Rta Tax 0.80 Pct                  |  6.54 |         |
| Sports Facility Tax 1.00 Pct      |  8.18 |         |
| Veh License Cost Recovery .48/Day |  6.72 |         |
| Sales Tax (10.0%)                 | 81.78 |         |
|                                   |       |  317.24 |
|                                   |       |         |
| TOTAL                             |       | 1046.54 |

Another way to look at it is that there is a 43% tax on top of the cost of the rental.

How is this right?

Continue reading →