May 2016 Archives

Wouldn't it be nice if you could write a program that could reach into an Apache config file (or an AptConf file, or an /etc/aliases file, Postfix master.cf, sshd/ssh config, sudoers, Xen conf, yum or other) make a change, and not ruin the comments and other formatting that exists?

That's what Augeas permits you to do. If a config file's format as been defined in the Augeas "lens" language, you can then use Augeas to parse the file, pull out the data you want, plus you can add, change or delete elements too. When Augeas saves the file it retains all comments and formatting. Any changes you made retain the formatting you'd expect.

Augeas can be driven from a command-line tool (augtool) or via the library. You can use the library from Ruby, Puppet, and other systems. There is a project to rewrite Puppet modules so that they use Augeas (augeasproviders.com/providers)

Version 1.5 of Augeas was released this week. The number of formats it understands (lenses) has increased (see the complete list here). You can also define your own lens, but that requires an understanding of parsing concepts (get our your old CS textbook, you'll need a refresher). That said, I've found friendly support via their mailing list when I've gotten stuck writing my own lens.

The project homepage is http://augeas.net/ and the new release was just announced on the mailing list (link).

Posted by Tom Limoncelli in Technical Tips

I maintain an open source project called Blackbox which makes it easy to store GPG-encrypted secrets in Git, Mercurial, Subversion, and others.

I've written up my ideas for where the project should go in the future, including renaming the commands, change where the keys are stored, add a "repo-less" mode, and possibly rewrite it in a different language:

https://github.com/StackExchange/blackbox/blob/master/Version2-Ideas.md

Feedback welcome!

Tom

Posted by Tom Limoncelli in Blackbox

The new issue of acmqueue magazine contains a preview of a chapter from our next book, the 3rd edition of TPOSANA. This issue contains a preview of a chapter from our next book, the 3rd edition of TPOSANA. The chapter is called "The Small Batches Principle". We are very excited to be able to bring you this preview and hope you find the chapter fun and educational. The book won't be out until Oct 7, 2016, so don't miss this opportunity to read it early!

ACM members can access it online for free, or a small fee gets you access to it online or via an app. Get it now!

Posted by Tom Limoncelli in ACM Queue Column

It makes me sad to see people type more than they have to. With these aliases, you reduce the 4 most common commands to 2 letter abbreviations:

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

NOTE: This updates your ~/.gitconfig file and adds aliasses "co", "br", "ci", and "st".

If you collaborate with others, git pull makes a messy log. Instead, always type git pull --rebase --ff-only. This will make the merge history a lot more linear when possible, otherwise it falls back to the normal pull behavior. Of course, if you set this alias git p is all you need to remember:

git config --global alias.p "pull --rebase --ff-only"

These last aliases pretty-print the output of git log five different ways. They make the logs colorful, beautiful, and much more useful. To be honest, I haven't spent the time to review the git manual to figure out how they work. I don't care. I copied them from someone else, who copied them from someone else. They work great. Thanks to the anonymous person that gave them to me. These aliases will help you love git logs:

git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.lgg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --name-only"
git config --global alias.ll 'log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat'
git config --global alias.ld 'log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph'
git config --global alias.ls 'log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative'

To install all these aliases:

Option A: Run the above commands. A copy has been placed at this link so you can download the script and run it.

Option B: Copy them out of my .gitconfig which you can access via this link

Option C: If you trust me, and you shouldn't, you can run:

curl https://raw.githubusercontent.com/TomOnTime/tomutils/master/gitstuff/install-fav-git-aliases.sh.txt | sh -x

Posted by Tom Limoncelli in Technical Tips

There is a long and fraught history in Bitcoin of claims and counterclaims about who Satoshi is. I might as well confess that he is me.

I come forward at this time because Craig Wright claims to be Satoshi and I can't stand such intentional scammery.

If you read any of my pre-Bitcoin books, you'll see there are many pages where the first letter of each line reads "I am Satoshi Nakamoto" and "Someday I will invent Bitcoin". If you can't find the page that contains this, buy more copies of the books. You just haven't found the right one. Please use this link, since it includes my Amazon Associates code. Buy additional copies since each one might be slightly different.

Further proof: The first letter of the chapter titles of Time Management for System Administrators, it spells "tfrttttpseeda". I mean, what hacker doesn't know what that means?

Oh, I guess you aren't elite. My bad.

Now let me address my critics: Some say that this is just Tom trying to promote his books. Well, if that's what I was doing, do you think I'd write this on my book-promotion blog?

By the way... you can get a sneak preview of my next book: First, the new issue of ACM Queue magazine has the complete text of chapter 2 (free to ACM members, everyone else pays a small fee). Alternatively you can also see the latest complete draft on Safari Books Online which you probably already have a subscription to.

That's all I have to say on this matter.

Posted by Tom Limoncelli in Funny

 
  • LISA17
  • Don't Miss Out - Register Today