How to Write Command Line Tools

The shell is a powerful tool that I think most people underestimate and under-utilize. Bash is probably the most common in the community, so we will refer to bash in all the examples, but all shells should support the same concept of redirection and piping. Below are some things to keep in mind when writing a program that is intended to run on the command line and play well with the shell.

HTML Templates in Go

Here is a quick example of how to use Go's html/template package to loop through a slice of structs and print out the contents. Note that in the templates {{.}} prints all the template variables, and . refers to the data passed.

type Person struct {
  var Name string
  var Age int
}

Simple struct definition for our Person

Why I Like Go

I think Go is a well designed and fun language to use. The standard library is pretty amazing, but here are a few things I like about Go. At the end are several references and links if you want to learn more about Go! Also check out my code snippets and references on GitHub github.com/NanoDano/reference

Preventing Cross-site Scripting (XSS) with CakePHP 2.x

Without proper care, developers can leave their CakePHP website open to cross-site scripting attacks. Controllers using scaffold functions do not take care to sanitize data, and leaves the website vulnerable. When using the bake tool in the console, it generates controllers as simple as the scaffold version. Some suggest storing the unsanitized data and escape the dangerous characters on output. In a perfect world I would agree with this approach, but it is easy to forget to sanitize output every time, or for an amateur developer to be ignorant of the dangers.

Getting Started with Vim

Beginners are often scared away from vi and vim from the start because the first thing they usually do is open it, try to start typing, and then see all kinds of random things happen, none of which type text to the screen. They even have trouble trying to quit! Well, fear no more, I've got the basics outlined here for you. For the record, vimtutor should come with your vim and it is the best place to start.

Customizing Gnome 3 Desktop Environment in Arch Linux

Arch Linux is known for being a lightweight do-it-yourself distribution. Unlike some other distributions like Ubuntu and Linux Mint that come with a preconfigured desktop and all the programs installed, Arch Linux let's you build things up from the ground up yourself. For the uninitiated this can be an intimidating task, but it's not that once you wrap your mind around it. I'm going to go over customizing a Gnome 3 desktop environment including icons, cursors, themes, wallpapers, etc.

Customizing Openbox Window Manager in Arch Linux

This article will walk through all the steps needed to create a unique and personalized desktop. I'll cover fonts, icons, mouse cursors, GTK themes, Openbox themes, Openbox menu generation, wallpaper and system monitors. In my example I will will make references to packages contained in Arch Linux. The same packages should be available for any popular Linux distribution, although the names may change slightly.

Installing, Configuring and Customizing Arch Linux

Arch Linux is a great distro that boasts bleeding edge up-to-date rolling releases as well as a very light and efficient base install. There is no graphical install and it expects you to have some basic Linux chops already just to perform the installation. Beginners shouldn't be scared away though because Arch Linux has a great wiki and awesome documentation.