Brad Lucas

Programming, Clojure and other interests

Yardwork

June 25, 2017

Weekend chore. The Mac has no more space.

$ df -k
Filesystem                1024-blocks       Used Available Capacity    iused     ifree %iused  Mounted on
/dev/disk1                  243924992  219810484  23858508    91%   55016619   5964627   90%   /
devfs                             180        180         0   100%        626         0  100%   /dev

Show directory sizes.

$ du -sh *

Continue reading →

Showip Example In Clojure

June 24, 2017

I found a small example I wrote last year. It shows the ip address of the machine from which the program is running. It does so by calling http://httpbin.org/ip. This url returns the callers IP address in JSON.

The example shows get-ing a url and parsing the JSON.

To access the url I'm using clj-http. This returns a map from which you want the value of :body.

The JSON return value will look like this:


Continue reading →

Python Virtualenv

June 23, 2017

Introduction

Virtualenv supports the creation of isolated Python environments. This allows you to create your project with all of it's dependencies in one place. Not only does this allow for a simpler deployment path when you release your project but it also makes trying different versions of libraries and experimenting safer.

The following is a good intro for virtualenv.

https://papertrailapp.com/systems/751509772/events

Notes


Continue reading →

Building A Weather App In Clojure

June 22, 2017

Overview

I stumbled upon this service called Dark Sky the other day which supports an API to return weather reports. I thought it would be interesting to create a small command line application which would query this API and print out a short summary weather report. Yesterday, I took up the challenge to build such an application in Clojure.

The results are up on GitHub in the following repo.

https://github.com/bradlucas/weather

For those who are interested I'll go through a process to build the application.


Continue reading →

Gist mode for the win

June 21, 2017

If you have a GitHub account you are probably aware of gists. Small mini repos which allow you to send links to their content easily. You can create secret and public gists and I've found them to be excellent for sending examples, lists and notes to others in a more contained format than email.

For example, you create a todo list and want to share it with your team. You create a gist of the outline and send everyone the link. The team can all see the outline, add comments and see updates much like a full git repo. All of this without the full setup of a repo.

Now if you use Emacs there is gist mode which makes creating and editing gists even easier.

The mode is available here https://github.com/defunkt/gist.el.


Continue reading →