Brad Lucas

Programming, Clojure and other interests

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 →

Competition Vs Comparison

June 20, 2017

Competition is something we are all aware of in our society. It is taught to us and bred into us from an early age. In fact you are pretty much setup to think that to get ahead you need to be competitive. Be better than anyone else and you will win. What you'll win isn't really mentioned just the idea of competing with others.

This of course makes sense in sports. You need to compete to win and to win is competing. That's fine. But how about in life? In work? Are you competing with others? I suppose you are in a general sense. You interview for a job and get it. Supposedly there are others wanting the job so you did compete and win in that situation.

But what about in other parts of your life? Are you competing with your friends, your neighbors the guy you just walked by? I don't think so but you might and by this I think you might because you compare.

I think constantly comparing yourself to others is a hidden form of competition that you learned throughout your life. I addition to learning to compete at sports or in school or in other places you also learned through marketing and advertising. Think about all the ads and TV shows that show others in more favorable situations. I say more favorable because the message is typically just that. Look at this person who has something you don't and is so happy because they do. The message is clear in that others have things, good things, expensive things that become things you want. You compare yourself to these other people and that is when you end up feeling bad.

Continue reading →