I am not a link bot… I hope

Once again my desktop has become to cluttered with links.  Here are some of the ones I have been using the last couple weeks.

Vim

  • Vim Cheet Sheet – A short list of useful Vim commands & short-cuts.
  • Vim copy and past commands – Setting blocks, yank, paste, cut, etc.. in vim
  • Vim word completion  – Found this more useful after binding it the completion command to the tab key (aka bash mode.)
  • Remove unwanted spaces – Because some “people” think using spaces instead of tabs is a good idea.
  • Accessing the System clipboard in Vim – Because Vim registers do not necessarily map to the OS clipboard.  The quick summary is that I would strongly recommend putting the following alias in your .bashrc if type “gvim” > /dev/null; then alias vim=”gvim -v”; fi then make sure you have gvim installed.
  • Using Vim Registers – Actually using the registered mentioned above.
  • Pasting in Visual mode – Using registers is great but not really useful if you keep having to switch back to command mode to use them.

DBus

Ruby

  • Singing with Sinatra Pt. 2 – Sinatra is a ultra simplified application server environment for Ruby.   Think Rails only about 1/10th its size.  This was the best of the tutorials I found for it.
  • Thin Server Production and static files – This little blurb was something I caught on StackOverflow and knew I would need for later as our production system is running into the same issue.
  • fpm (freggin package manager) – Tool for creating deb/rpm packages from lists of filesystem files.  Particularly useful for gem files (it even has it as an option.) I am in the process of moving over my existing ruby build scripts over to fpm.

Debian

  • Creating Meta Packages – Meta packages are simply empty deb packages that contain nothing but a list of dependancies.  This way you can create a batch of files to be installed for a given purpose (like installing KDE Desktop.)
  • equivs-control man page- Used in the creation of Meta packages
  • Binary Package building tutorial for Debian – The deb build package environment basically builds itself around have source for all software.  This is a problem for packaging non-open source programs that don’t provide a source.  This is a tutorial for how to do it.
  • Template Changes file – Debian apt repositories generally work with .changes files to actually publish their packages.  This is an example of a changes file for the package dpkg-ruby.
  • Create you own apt repository – Includes information on upload support (which uses changes files mentioned above.)
  • Creating a basic Ruby application structure – How to create you base dependencies, directory structure, and file-system layout for a base Ruby project.

Unless you continue to remember it

The dynamic device interface for Linux is called udev.  Generally it works without complaint or frustration but it does have some interesting side effects if you are doing more involved system configuration.  The one that tripped me up today is that udev keeps a record of every nic card that has been dynamically created during it’s lifetime.  For example, if you are using wireless USB nic (see my post yesterday) and you plug in a different one than you used before; the new nic ID is going to be wlan1 instead of wlan0.  Generally nobody would care; but in this case I did.  Thankfully modifying these records is pretty easy.  The device history is stored in /etc/udev/rules.d/70-persistent-net.rules and can be modified by hand.  Just change the wlan1 to wlan0 and delete the other entry.

Once again, text file configuration is FREAKING AWESOME!

The gap between the ones and the zeroes

Wireless configuration on embedded Linux systems has been pretty well documented for a while now.  If you are running a Desktop version of Linux then the probability of your wireless device being supported (either natively or through the WindowXP visualization layer NDIS) is likely to be transparent to you.  The situation is slightly different when you enter the embedded side of Linux where non-native driver support is really not an option.  That said, I have fallen in love with the Edimax Technology wireless USB nic (it uses the RealTek chipset) because they are smaller than my thumbnail, work with any Linux distribution you can think of (even Raspberry Pi), and  cost about  10 bucks.  Heck, they even support 802.11n.  To get this thing enabled/working on Debian from the command-line has been pretty simple.

apt-get install firmware-realtek
modprobe rt18192cu
ifconfig wlan0 up

Then iwlist wlan0 scan will show you a list of the available wireless networks.  Basically apt-get download the drivers, modprobe installs the the drivers, ifconfig turns on the wireless device (otherwise you get a wlan0 Interface doesn’t support scanning : Network is down when you try to scan the.  Not exactly the best error message, but anyway…

The evils which have never happened

I found this stupidly useful shortcut inside of cron.  Generally crontab entries look like this:

* * * * *  username dosomething

With the * corresponding to minute, hour day of month, month, day of week.  But cron also has a couple shortcuts that are useful for general system maintenance.  Specifically @reboot which replaces  ALL of the “*”‘s and will be run after each system reboot.  There is also a system wide directory under  /etc called cron.d which is wonderfully useful for package management because you can drop custom package cron jobs into the directory without directly editing the crontab file.

All of this information is well know among the Unix community as a whole and fairly well mentioned is about 10,000 different places.  Here is something that isn’t quite as easy to find but still ends up being pretty important…

File entries in cron.d cannot have a period in their name…. no file extension… no period separator… NOTHING… otherwise cron simply doesn’t run the file!!!

I just about killed myself debugging this one over the last two days. </crying>  Now if you will excuse me, I am going to drink my body weight in beer.

Frittered away by detail

My first reading of the http 2.0 draft proposal left me with the feeling that they were trying to address issues that are not really problems.  At least, not a problem unless you happen to be someone like Google or Cisco.  Part of what has made the internet so ubiquitous is the easy ability for people to see and understand the basic underpinnings of how everything works.  For example, I challenge you to find a developer who didn’t start their career by right-click -> View Source’ing a website. This is the very same reason that exceedingly popular web specifications are commonly NOT industry specifications. For example something like XML is so obnoxiously complex and excessive that it often seems like the only companies using (and making money) of such technologies are large institutional players like Oracle and IBM.  Instead start-ups, innovation creators, and entrepreneur continually choose things like JSON because it is simple and easy to make robust.  Honestly, I don’t know a single developer using AJAX that actually uses XML (the X in AJAX) because all it does is add size and complexity.

If you get the chance please read this great post by The Accidental Businessman.  It does a good job of explaining some of the issues I see in http 2.0 and what we are loosing by making a more “computer focused” internet.

Its appointed time for everthing

If you are a command line junkie, you really need to check out @climagic on twitter.  Some days are better than others but I am constantly amazed at what is possible in bash/csh.  That said, here are a couple commands I have needed recently, many will be worthless to anyone else but oh well:

  • ar vx mypackage.deb Unpackage a Debian binary install package. The result is actually three tar.gz files
  • dpkg -l  – List all installed Debian packges on a given system.
  • dpkg -c mypacakge.deb  –  List all files provided by the named Debian package.
  • hub pull-request -i 123 -b account/project:master -h account/project:branchtomerge  –  hub is a github utility that allows you to use some github functionality directly from the command line.  The preceding command will issue a pull request for branchtomerge into master and even tie the request to a given issue number (in this case issue #123.)
  • echo $(sha256sum $DEB | cut -f1 -d’ ‘) $(ls -l $DEB | cut -f5 -d’ ‘) $(basename $DEB)  –  This command creates the package hash structured named used INSIDE of Debian changes files.  Using the same command with (sha1sum|md5sum|sha256sum) will provided all three needed package id’s.  The reason this is useful is when you need to recreate a changes file without the original source package.  The rest of the file is fairly straight-forward but the signed package section has to absolutely precise. Also check out this link for more information.
  • asciiquarium  – OK, you might have to install this one first, but it is a full aquarium in ascii characters, including sharks that eat the fish.  Submarines, fishing hooks, and even the lock ness monster.
  • grc tail -f /var/log/maillog –  Note to self, I need to make an rpm for this package.  grc is a generic colorizer for other command line programs that don’t use color by default (like tail, traceroute, syslog, etc…)
  • isohybrid -h 64 -s 32 mycdimage.iso  –  Adds a simple filesystem layout to a standard iso image so it can be written to USB drive as well as an regular CD.  Really useful for building custom Linux CD/USB images.

Forms it never takes, places it can never be

So, after looking around for an answer today I finally found out where the Debian install CD stores its cd/usb boot menu configuration files.  While I have already had a great deal of experience editing grub.conf files by hand, this methodology simply doesn’t work on an “El Torito” Joliet CDROM image.  So Debian set-up their boot image (as part of the initial ram disk) inside of the /ISO/isolinux/ directory where ISO is the uncompressed version of the boot image.  Specifically you can configure things like:

  • The boot option timeout in /isolinux/isolinux.cfg
  • The background splash image in /isolinux./splash.png (640×480 on the default menu set-up)
  • Which sub-menu’s, options, boot methods, and GUI installs are available via the /isolinux/menu.cfg

Honestly, I may be the only person on the planet trying to figure this stuff out; but here it is for future reference or for anyone who wants to make their very own custom Debian install CD .

That Time Does Not Reveal

A democracy cannot exist as a permanent form of government. It can only exist until the majority discovers it can vote itself largess out of the public treasury. After that, the majority always votes for the candidate promising the most benefits with the result the democracy collapses because of the loose fiscal policy ensuing, always to be followed by a dictatorship, then a monarchy.

Between the NSA, the IRS, the AP, and the US Embassy, it is looking like a tough time for Democracy.  Unfortunately any current scandal is simply an extension of a government refocused towards a propensity to redact the freedoms people before us fought to give our children.  At this point can Syria turn out any better than Afghanistan?  Than Iraq?  For the last 80+ years, slowly, steadily, we have been building a government that can solve all our problems; we cannot act surprised that it tries to.

For those that know history, it is hard to not see what is happening as the slow silent exhale of the last breath of democracy.

The America of my time line is a laboratory example of what can happen to democracies, what has eventually happened to all perfect democracies throughout all histories. A perfect democracy, a ‘warm body’ democracy in which every adult may vote and all votes count equally, has no internal feedback for self-correction. It depends solely on the wisdom and self-restraint of citizens… which is opposed by the folly and lack of self-restraint of other citizens. What is supposed to happen in a democracy is that each sovereign citizen will always vote in the public interest for the safety and welfare of all. But what does happen is that he votes his own self-interest as he sees it… which for the majority translates as ‘Bread and Circuses.’

‘Bread and Circuses’ is the cancer of democracy, the fatal disease for which there is no cure.

Building Debian For Fun and Profit

I needed to document the process I used to get a private Debian package repository with some custom applications.  Here is the process I went through.  You can find some reference links under my previous articles “Debian” heading.

Building

Basic steps to building setting up your personnel project to build Debian packages.

  1. Get most recent software version for your project (git pull, etc..)
  2. Rename project folder to include a default project number.  For example $mv myProject myProject-1.0
  3. In project directory run dh_make.  This will create a debian diectory with all the necessary files to build a deb package.
  4. Now would be a good time to edit your debian/control file and make any changes needed.
  5. If you project is a simple copy operation (say a php web application being installed onto an existing apache server) you will want to do the following:
    1. Create and edit a new file under debian/ named myProject.install (replace myProject with the name of your project.)
    2. Edit the file to specify the where you want the files copied to.  The format of the should be something like this (notice you can use wildcards:)

      myfolder/bin/* usr/bin
      src/etc/myproject.config etc/
      myfille usr/share/myfolder

    3. Make sure you debian/rules file looks something like this:

      #!/usr/bin/make -f

      %:
      dh $@

  6. Now, you should be able to build your package (and the changes & dsc files) by running dpkg-buildpackage.  The resulting packages will be in the directory one level up.

Hosting:

Hosting your own git repository can vary in complexity depending on which software you use to actually build the repository.  The easiest one I found to setup was mini-dinstall.  Start by installing mini-dinstall and apache2 via apt.  Apache is configured to start a basic server (all that we need) with the web page files hosted in /var/www.  Just clean out the www directory, add the mini-dinstall folders after the install:

rm -rf /var/www/*
mkdir -p /var/www/mini-dinstall/incoming

You will also need to create a configuration file for mini-dinstall to use when creating the package repository supporting files. Create/edit the file /etc/mini-dinstall.conf with something like the following:

[DEFAULT]
archivedir = /var/www
mail_to =
verify_sigs = false
architectures = amd64
archive_style = simple-subdir
generate_release = true
mail_on_success = false
release_codename = myreponame
release_description = My Repo Name  Hosting
release_label = myrepo
release_origin = myrepo

At this point mini-dinstall could be configured to run in server mode and watch for incoming packages, but using the utility below I have mine configured to run in batch mode every time I put new files on the hosted server.  This will cause mini-dinstall to create a debian package repository structure that can be accessed directly via apt.  Just add something like the following to your /etc/sources.list

deb http://yourserver.com unstable/abd64/

Deploying:

There is a really nice utility called dput that can be used for deploying software packages (and change files) to a hosting server.  The easiest way to get started is to install dput and then setup a configuration file.  Create a file in your home directory called .dput.cf (or globally in /etc/dput.cf) and add a deployment location like this:

[myservername]
fqdn                    = debian.myserverurl.com
method               = scp
incoming            = /var/www/mini-dinstall/incoming
login                    = root
post_upload_command = ssh root@debian.myserverurl.com mini-dinstall -b

That last line creates the repository using mini-dinstall mentioned above in section “hosting”.  This is particularly useful if you already share public keys with the remote system via ssh.  One you have set it up you can do deployment by typing:

dput -u myservername myproject.change

Where myproject.change is the file created above in “Building”.

Looking for Trouble

My goal in life (and this blog) is not to become a gigantic link-bot but I never seem to finish all the articles I want to save and return to… until I do. So here is the most recent reading life I have for June of 2013.

Other Technology

  • Build Your Own Google TV using Linux, Nodejs, Socket.io, Linux, and a RaspberryPi
  • arkOS your own personnel home cloud (without the NSA) on a $35 RaspberryPi.
  • TTYtter a command line based twitter client for Unix.  Can be run in disconnected mode (for a stand alone twitter “bot”), has some initial support for libnotify, and can even be scripted.
  • Using Git to backup $HOME One developers experience using Git as a home directory backup, tracking, and versioning system.  I am working on the same idea right now.
  • Configuring Keyboard Layouts on a per keyboard basis.  Particularly useful when F*$*(#NG Apple decides to move the Alt and Cmd keys from their 30 year old locations… but all your USB keyboards use the default locations.

Start-ups and Business

  • Startup Advice 95 pieces of advice Sam Altman has heard about creating, managing, and developing a startup.

Software Development

  • Shortcut Training Interval Training for learning keyboard short-cuts.  Including Vim & Emacs
  • Github Pre-commit hooks StackOverflow topic discussing setting up and testing pre-commit hooks on Githubs JSON API.  Github actually has a pretty decent into into some of their other hooks as well, see Post-Receive Hooks and Testing webhooks
  • Complex Responsive webapps more of a personnel anecdote than a tutorial but has some really good information on building responsive websites… after the fact.
  • Introducing Foreman Start-up manager for multi executable webapps.  Specifically in Ruby

Debian Linux

  • mini-dinstall On-line man page for mini-dinstall.
  • dh_install StackOverflow explanation of setting up a simple direct copy install rule for deb packages.  Particularly useful for web deployment packages.
  • gem2deb Github project page for gem2deb software.  Helps in created deb packages from Ruby gems also check out the Debian Ruby Packaging Team Wiki.
  • deb package building Debian.net forum post covering package building.  Some useful tips from here.  Honestly, RPMs are still my preferred method for building software packages.
  • debchange manpage debchange is probably the simplest way to create changelog entries in Debian.  Changelog formatting (a requirement to build packages) is a seriously painful process without this.
  • Debian Maintenance Guide This is chapter 4 that specifically covers debian directory file requirements when building deb packages.  Chapter 6 covers building, the Mentors FAQ  and Package FAQ have some good information as well.
  • Debian Admin Handbook Particularly this chapter (15.3) covers setting up an APT package repository using mini-dinstall.
  • Using dput with mini-dinstall A quick tutorial on using these two systems together.
  • dpkg cheatsheet Because I didn’t know how to do rpm -qi and rpm -qa in dpkg.
  • Debian Ruby Packaging Team Info includes tools, tips, standards, and links to information about packaging Ruby gems on Debian.