the place i store my stuff…

I have been doing large scale deployments of Raspberry Pi’s for some of my students and their class projects; and after doing… say.. two of them decided it would be easier to script the initial setup. The process isn’t hard but I thought I would document it in case anyone else was in a similar situation.

I start by connecting the Pi’s to a network via cable (some people carry handkerchiefs, I carry switches.) Raspbin starts with DHCP enabled and SSH configured for a default user, meaning we can use that to get the wireless configured. Here is basically what I do in my script.

Getting Connected

Start by doing a port scan for any ssh connections on the network once the Pi is attached. For example:

nmap -T5 -n -p 22 –open –min-parallelism 200 172.16.0.0/24

We do this to pre-load our local arp table with IP & MAC addresses. This will speed up the process of finding any Raspberry registered MAC addresses (Raspberry has their own MAC range.) You can then search for Raspberry nics’ specifically by doing:

arp -a | grep b8:27:eb

You should
SSH (or better yet copy your private key via ssh-copy-id) to the IP address(es) returned from the above command. Make sure to change the password afterwards. The default username and password for the SSH connection are:

Username: pi
Password: raspberry

Wireless Configuration

Plugin your wireless USB (unless you have a PI3 or later) and run the following command to see the wireless card:

iw dev

The result will be a list of physical wireless devices. You’re looking for the entry next to Interface mostly likely something like wlan0. Run the iwlist command to get a list of wireless access points you can connect to.

iwlist wlan0 scanning

Specifically you’re looking for the value next to ESSID. Find the one you want to connect to. To setup the encryption for secure wireless run the following command to add a specific network entry for your ESSID. Replace XXXX with the ESSID name you want to connect to.

wpa_passphrase “XXXX” >> /etc/wpa_supplicant/wpa_supplicant.conf

Now type the wireless access point password and hit enter. Finally restart the wireless interface to load the new network and get an IP address. Replace wlan0 with the Interface name you used for scanning a couple steps above.

ifdown wlan0
ifup wlan0
ifconfig wlan0

The ifconfig is to see what your new wireless IP address is. You can then safely disconnect the wired network cable and SSH back into the PI on the wireless nic. The PI can safely be restarted at this point as the wireless will auto-connect on restart.

I need a pure mathematician to discuss this with me but I have been having some shower thoughts on infinite numbers and their implications. I am not a formally trained mathematician and am almost certainly using words like “set” and “infinite” differently than would be properly used by one, but regardless I need to get these out of my head.

First, it seems logical for order sets of infinitely large things, of a defined group, that the nature of their being ordered would mean all possible patterns for that set would occur. For example the defined group of 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 in the order of “1”, “2”, etc through infinity would always contain any possible finite “number” regardless of the patter if we assume the patter must contain those ten characters.

Second, it seems just as logical for unordered sets of infinitely large things, of a defined group, that the nature of their being unordered would mean all possible patters for that set would NOT occur. In other words, that because such a set is ordered in a non-exhaustive way that even if the set was used infinitely it would not guarantee all possible discrete sets would be used. For example the defined group of a, b, c, d, e… through z order via “one”, “two”, etc. through infinity would not automatically contain the word “xxxzxxznnnzzz” because such word violates the rules of the English language. So an infinite number of words would be produced but non of them would be xxxzxxznnnzzz.

The natural implication for this is that for sets that have arbitrary rules that the normal assumptions for infinite breakdown.

A totally different question also comes to mind. For infinite numbers that (although unordered still contain all possible patters) for example pi. Do specific patterns in these sets generally appear random (at least within the confines of their set length?) Is their randomness generally uniform?

Over the course of the last couple years of I have been putting more thought into some of the core beliefs I hold about things other than faith or family. How do I see the world and how does such beliefs affect my decisions and opportunities. Piece by piece I have been writing these down and although I am certainly NOT done, have decided it is time to actually “say” them out loud.

I believe in actions and always distrust intentions. Every man believes in the cause of his behavior even when that behavior brings about pain and suffering. Those who created socialism believes they were bringing about an egalitarian utopia and inquisitors believed they were saving the souls of men.

Concentrated power is not rendered harmless by the good intentions of those who create it. –Milton Friedman

The evil that is in the world almost always comes of ignorance, and good intentions may do as much harm as malevolence if they lack understanding. –Albert Camus

I believe those who desire to “throw away and start from scratch” dramatically underestimates the complexity of a given problem. Real change happens through evolution over time, through trail, through error, and through the accumulated power of experience to reinforce decisions. Throwing away history for no reason other than frustration with having to deal with it, most often causes one to repeat it.

It’s important to remember that when you start from scratch there is absolutely no reason to believe that you are going to do a better job than you did the first time. First of all, you probably don’t even have the same programming team that worked on version one, so you don’t actually have “more experience”. You’re just going to make most of the old mistakes again, and introduce some new problems that weren’t in the original… –Joel Spolsky

I believe people are most truly defined by the parts of ourselves that we say NO to. I don’t drink, I don’t borrow money, I almost never drive a car, and I won’t have sex until I am married, say more about a person (good or bad) than the 10,000 things everybody does or everybody wants to do. Saying yes implies we are like everyone else, that you capitulate to the will of society. Saying no is self sacrifice and a dramatic statement of individuality.

Be who you are and say what you feel, because those who mind don’t matter, and those who matter don’t mind. –Bernard M. Baruch

I believe great acts take great sacrifice and the only sacrifice this is truly great is self sacrifice. While it may sometimes be necessary to force others to sacrifice, there is never anything admirable about it. No man should be held in esteem for giving something that he took from someone else. Sacrifice is not sacrifice when forced upon.

A man who was completely innocent, offered himself as a sacrifice for the good of others, including his enemies, and became the ransom of the world. It was a perfect act. –Mahatma Gandhi

The really important kind of freedom involves attention, and awareness, and discipline, and effort, and being able truly to care about other people and to sacrifice for them, over and over, in myriad petty little unsexy ways, every day. –David Foster Wallace

I believe that the ends almost never justify the means. Partly because, I believe that there is no ultimate good that springs magically from a “necessary” string of injustices and evil. But also because we become what we do and our actions ultimately sculpt us into the object of our behavior.

…let a prince have the credit of conquering and holding his state, the means will always be considered honest, and he will be praised by everybody because the vulgar are always taken by what a thing seems to be and by what comes of it; and in the world there are only the vulgar, for the few find a place there only when the many have no ground to rest on. –Niccolò Machiavelli

I believe, and can categorically prove, that the free market is the greatest vehicle for eradicating poverty, hunger, and disease that has ever existed. Nothing, no government program, no charity organization, no religious denomination has come anywhere close to the success that the free market and capitalism has at improving the corporeal lives of the human race.

Commerce [and] entrepreneurial capitalism take more people out of poverty than aid. We need Africa to become an economic powerhouse. –Bono

It is not from the benevolence of the butcher, the brewer, or the baker that we expect our dinner, but from their regard to their own interest. –Adam Smith

ThunderPlains 2015 is over and overall I was impressed with the quality of the presentations, the overall event, but mostly the OKC community as a whole. Particularly as this was only the second year of this event.

The day started with a significant announcement, CodeForOKC.org will hold its first meeting later this month. Most people who know me, know that I am a small government libertarian; but I am a huge fan of local government (government is best when it is closest to the people it represents.) This will give coders a chance to service their local community. The first meeting will be on October 27th at 6:00 PM, check out the meetup.

Listed is some of the presentation material, links, and references mentioned by the presenters (at least for the sessions I attended.)

The Importance of Building Developer Communities

I have over 200 tabs open between three computers… the insanity must stop. Link dump to follow:

Software Engineering

Road to Continuous Delivery – Great article covering the different stages development shops go though to get to continuous delivery. Provides a great starting checklist of what to work on while improving your software delivery process.

Overview of Micro Services – Micro services have become massively popular with the advent of Node.js. Intro to the concepts are reasoning for using micro services.

Don’t Be Afraid of Functional Programming – The parts of JavaScript I actually like are its functional programming capabilities (callbacks and first class functions baby.) OOP programmers get a little scared of things like Lisp, but they shouldn’t be.

Ncurses Programming in C – Another Linux Documentation Project about programming. Ncurses is a command line interface for gcc.

Coding Unit, C Tutorial – Great introduction to C programming. Simple examples and be sure to check out the comments below each section.

TutorialsPoint, The C – Another introductory guide to C development. Better as a reference guide that the one from Coding Unit.

TDD in C – Love test driven development (not so much behavior driven development.) Simply way to due it in C without external dependencies. Here is a list of tools if you do want to use external libraries for TDD.

QTSerialPort – The Qt Library for Serial port communications. Qt is easily the best C++ code library in existence. While most people think of Qt only when coding GUI applications; its libraries are extensive enough to use for ANY application… even from the command line.

Recover files with Grep – Grep can grep anything… even things that are supposed to be deleted. Great example of the low level power of the Unix tool set.

SSH

Rsync & SSH – Combining two of the most powerful software utilities in existence to make backups.

StormSSH – I actually created a series of bash scripts to do SSH bookmarking. Storm improves on this idea by directly editing your ssh config file with the stored entries. Wish there wasn’t a Python dependency.

SSH Kung Fu – Great tutorial covering some of the many of the one-off capabilities of SSH like remote folder mounting, port forwarding, and connection sharing.

Simplify With SSH Config – Good overview of some SSH configuration and setup options. Plays well along side the SSH Kung Fu link above.

Autocomplete Hostnames – Process your hosts file under /etc/ as well as your config files for autocomplete. I used my hosts file as a blacklist so this doesn’t work as well for me but the information was useful for the SSH bookmark system I made.

BashGuide – Better bash than the Gnu Bash guide… or at least some people say so. Evidently it has fewer “bugs” in its code examples.

Linux Bluetooth

Bluetooth on Fedora – A number of Bluetooth devices need re-pairing (or at least a user to be logged into the system) before they will connect after restart. This is particularly frustrating for Bluetooth mice and keyboards. Following the advice by the selected answer (as root0 solved the problem for me. This one was annoying and hard to find out.

ThinkPad Compact Bluetooth Keyboard – Cannot wait until this keyboard driver is put in the mainline kernel so I don’t have to build it every time. This keyboard allows me to use the same keyboard when using my Carbon X1 or when at my desk.

Misc

Clark DuVall – I don’t know who the guy it, but he has the most freaking amazing website I have ever seen! Command-line junkie heaven.

Bluetooth Deadbolt – Something to keep my from having to carry another key? Plus it lights up!

LibreOffice & Google Docs – Open, edit, and save/upload Google Docs directly in Open/Libre Office. Also has support for WebDAV.

The most difficult aspect of software development for new programmers often has nothing to do with algorithm complexity or syntactical quarks; it’s all the other “stuff” associated with building, managing, and testing software systems. When a developer steps into a existing business that already has a software stack to support the problem can be mitigated by relying on the institutional knowledge that the existing developers have formed over the course of maintaining their software. I haven’t, in most cases, had that fortune in my career because either a) I was the companies first software engineer, or b) the existing software engineers had become proficient at a “alternative” software stack (and honestly, alternative is the kindest word I could come up with for Mainframe/Cobol.)

The longer a programming language has been around the more complex these build & management tools get. The reasons are pretty simple. The longer a language has been used, the more complex and more broad the uses of that language become. Build tools generally start off pretty simple (make was originally an 8 line bash script for gods sake) but they must expand to cover more and more complex setups with more and more non-standard configurations. In the most extreme cases the support tools even need to consider multiple platforms on multiple hardware configurations. This problem can be exacerbated when a language needs to be “compiled” (and I use the term loosely) or works on “core” systems, meaning closer to the hardware, network, or data layer.*

C suffers from all of the above listed problems and more. Having been around for around 40 years, in constant usage, on every platform ever made (super-computer to toasters), used for hardware drivers, operating systems, core network stacks, and even to create other programming languages; means that C can be the most complicated system ever supported by mankind. I’m really not kidding about this. More than one person has pointed out that the Linux kernel (95% pure C code) is many orders of magnitude more complex than sending a man to the moon is or even sending a woman to Mars will be. Anyone who has had to create a Gnu build-chain supported C program from scratch has had to kill themselves learning the intricacies of make, automake, config, autoconfig, m4, autoreconfig, cmake, libtools, and autoheader. Seriously, a “correct” Gnu C project with 1 header file and 1 c file has 26 buildchain files supporting it on initial setup.

Recently I have been doing some really interesting C development on micro-mobile platforms. The first language I did significant (i.e. not a GWBasic MadLibs game) development on was C.*** My college experience with C was relegated to a couple hundred lines and using the up arrow to re-compile the program after changes. Now my annoyance with with the autoconf build tools (and its many many gotchas) is replaced with the need to support cross-compiling, manage external libraries, and automate build deployments. I have had to learn each of these tools and what it is they accomplish for me so I don’t have to re-invent the wheel. Here are some of the more useful sources of information I have come across:

Gnu Autoconfig, Automake, and Libtools – by Gary V. Vaughan, Ben Elliston, Tom Tromey and Ian Lance Taylor. Available as a Web Book it covers the entire build chain and practical usage of each of the tools. Also does a great job of showing how modern technological development owes a huge debt to the flexibility and power these tools gave (and continue to give) C developers.

Gnu.org amhello – A “Hello World” tutorial for getting Autotools setup and configured in a simple project. Great example for getting a full build setup running for C. The full code of which can be found in the automake doc folder on Linux systems, generally something like /usr/share/doc/automake/amhello-x.x.x.tar.gz.

Clemson Automake by Example – Old article (the pages images are all broken) that walks through a simple C program and its build chain. Excellent tutorial for getting a notice programmer setup with a distributable and effective build environment.

Autotools Mythbusters – Practical, if high level, overview of autotools and its associated components. There is an Appendix with a list of examples that is particularly outstanding. Think stackoverflow for autotools that has been aggregated into a Cookbook.

Simple Makefile Tutorial – A newbie guide to creating Makefiles for building software. If I include code examples in the project documentation I will generally create a simple Makefile that will build the examples with a “make someexample”.

Martin Mann’s HowTo Autotools – The examples are in C++ but the step by step process to add functionality to the autotools build chain is outstanding. Especially useful if you have figured out some of the basics already.

Finally, because setting up and creating the necessary files for getting a C project started in libtools/automake are so annoying, I decided to create a single file bash script to do the work for me. You can find it as a gist on github. You can download and run it by doing a:

On the Linux command line. Then create your new C/Autoconf project with cmaker init newprojectname. My primary concern with the script was that is should need NO outside dependencies besides libtools/automake itself and that it has everything needed to start the autoreconf –install, ./configure, make process. Hopefully I will add some additional functionality to it soon.

* As an example, look at Perl. It initially started as a glue language to allow developers to piece together software solutions in a single language instead of having to create divergent sed, awk, and grep scripts in sh**. Then the WWW took off and the little glue language became the core component of the most powerful websites on the planet. Perl went from being a support language to the core language of all things http. The number of tools exploded. CGI.pm, mod_perl, and DBI gave the developer massive power but managing these libraries in production created a boom of support tools (kids these days forget that cpan was the ruby gems/bundler of its day.)

** As a side note that last sentence sounds more like a caveman grunting then a discussion of software development tools.

*** OK, ttechnically it was C++ but our CS chair was a former NASA Chief Engineer who basically taught us C using a C++ compiler… with a little Class thrown in. I think my first object was linkedList with methods push and pop.

Something about Holy Saturday has always felt strange to me; like the whole world is holding its breath after a crime. We are seeing if it was actually possible that we could get away with killing the creator of the universe.

The Bill of Rights is a literal and absolute document. The First
Amendment doesn’t say you have a right to speak out unless the
government has a ‘compelling interest’ in censoring the Internet. The
Second Amendment doesn’t say you have the right to keep and bear arms
until some madman plants a bomb. The Fourth Amendment doesn’t say you
have the right to be secure from search and seizure unless some FBI
agent thinks you fit the profile of a terrorist. The government has no
right to interfere with any of these freedoms under any circumstances.
–Harry Browne