Terminator color palettes

Bored of the normal everyday terminal colors? These can be easily changed by right clicking on the terminal window, clicking preferences and changing the colors:

You can see how my terminal colors are different than standard:

If you want to know where this information is stored on your filesystem:

#!/bin/bash
cat ~/.config/terminator/config

My current palette:

palette = "#2e3436:#cc0000:#4e9a06:#c4a000:#c48dff:#75507b:#06989a:#d3d7cf:#555753:#e52222:#a6e32d:#fc951e:#3465a4:#fa2573:#67d9f0:#f2f2f2"

The same can be done for gnome-terminal, but that stores it’s defaults in gconf. You can retrieve them using gconftool-2:

#!/bin/bash
gconftool-2 --all-entries /apps/gnome-terminal/profiles/Default

This is fun as these colors carry over into Vim etc, so when you are not using the graphical versions, you can still spice up your syntax highlighting.

Stylish desktop, new search engines

My Desktop
Read Seif’s post on his desktop, so I copied most of that style (original post) :

Desktop

I actually enabled compiz for the first time in a long time, and AMD’s linux drivers have come a long way since my critical posts a few years ago about them. Great to see the whole stack improving.

Default Search Engine
This week I switched over my default search engine to Duck Duck Go.


I really like it’s clean interface, and their attention to privacy and technology enthusiasm.

New Home Page
In addition, I updated my generic landing page using Python / Flask to pull feeds etc, I really like the simplicity of Flask and the well thought out design / documentation. I also published the source on github.

Using Apache to decrypt SSL pages

Although you should almost never have a decent rationale for doing this, at some point I needed to do it, and documentation was scarce. The basic idea is we have a website – https://www.securewebsite.com and our clients cannot use https (ssl), so we need to decrypt it to http for them.

In order to accomplish this, Apache 2.x is needed, along with mod_ssl and mod_proxy. Here is the magic:

<VirtualHost virtualhostipaddress:443>
        SSLProxyEngine on
        #SSLProxyCACertificateFile /etc/apache2/ssl/google.crt
        SSLEngine on
        RequestHeader set Front-End-Https "On"
        ServerName testing

        #SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile /etc/apache2/ssl.crt
        SSLCertificateKeyFile /etc/apache2/ssl.key
        #LogLevel debug

        ErrorLog /var/log/apache2/ssl_proxy_error.log
        CustomLog /var/log/apache2/ssl_proxy_access.log combined

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyVia On
        ProxyRequests Off
        ProxyPreserveHost Off
        ProxyPass / https://www.securewebsite.com:443/
        ProxyPassReverse / https://www.securewebsite.com:443/

        #SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [1-4]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [5-9]" ssl-unclean-shutdown
</VirtualHost>

Obviously replace virtualhostipaddress with the ip you want to bind to and securewebsite.com with the actual website.

Linux guru needed

I have another position open, it’s a contract position for 3 months atleast. Pays great, will need to come onsite to Cincinnati.

Skills we need:

  • Administration – familiar with Apache / SSL / SSH / Kickstart or autoyast / rsync / hardening etc
  • Virtualization – xen
  • RPM creation
  • Perl (Catalyst is a plus)
  • PHP (Symfony is a plus)
  • Python (Django is a plus)
  • C
  • Compiling kernels, making slight adjustments to drivers etc
  • Thin client experience is a plus
  • Software distribution (ZLM / Altiris)
  • Bash scripting
  • Javascript / Jquery
  • HTML / CSS
  • Rest
  • XML / JSON / Yaml
  • Git / Bazaar / Svn
  • Having a github or launchpad account is a plus

If you think you fit the bill email me ASAP as it is an immediate opening, and I will put you in touch with my HR department. You can find my email through Launchpad or Google.

SLES 11 SP1 and Novell / SUSE Autoyast with Intel / Dell Raid Controllers

When using an Intel raid controller, you have two options: let the raid controller handle the raid, or run a linux software raid (md). If you want to run a linux software raid, and use autoyast, a prompt box will popup during the middle of the installation. This becomes a problem if you are imaging several thousand Linux systems.

Add this to your bootup options (in our case PXE config, but you can type it manually also from the installation CD prompt):

libstorage_imsm_driver=mdadm

That is all there is to it. To configure the rest of autoyast, you can check out Uwe Gansert’s website as he maintains it: http://www.suse.com/~ug/

Other hard to find resources when tracking these things down:

Programming using IOCTL to interface with Linux kernel drivers

IOCTL is a function call that allows you to interface with kernel drivers, allowing you to adjust settings or set parameters from code without compiling a new module.

From a programming perspective, having the linux kernel source is a prerequisite. In this example, I cloned the main kernel:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux

Once I had the source, I specifically wanted to see exactly how I could interface with the driver called usblp. I was using a USB to parallel port converter, and wanted to see if there was any way to force it to operate differently as we needed a non-printer device to work with it.

After opening the kernel source, I found the driver file itself which was under /drivers/usb/class/usblp.c. In this file I found a section of information about which IOCTLs it supported, and put them in a header file for my program called usblp-hack.h:

#ifndef USBLP_HACK_H
#define USBLP_HACK_H

#include <linux/ioctl.h>

/* ioctls: */
#define IOCNR_GET_DEVICE_ID     1
#define IOCNR_GET_PROTOCOLS     2
#define IOCNR_SET_PROTOCOL      3
#define IOCNR_HP_SET_CHANNEL        4
#define IOCNR_GET_BUS_ADDRESS       5
#define IOCNR_GET_VID_PID       6
#define IOCNR_SOFT_RESET        7
/* Get device_id string: */
#define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
/* The following ioctls were added for http://hpoj.sourceforge.net: */
/* Get two-int array:
 * [0]=current protocol (1=7/1/1, 2=7/1/2, 3=7/1/3),
 * [1]=supported protocol mask (mask&(1<<n)!=0 means 7/1/n supported): */
#define LPIOC_GET_PROTOCOLS(len) _IOC(_IOC_READ, 'P', IOCNR_GET_PROTOCOLS, len)
/* Set protocol (arg: 1=7/1/1, 2=7/1/2, 3=7/1/3): */
#define LPIOC_SET_PROTOCOL _IOC(_IOC_WRITE, 'P', IOCNR_SET_PROTOCOL, 0)
/* Set channel number (HP Vendor-specific command): */
#define LPIOC_HP_SET_CHANNEL _IOC(_IOC_WRITE, 'P', IOCNR_HP_SET_CHANNEL, 0)
/* Get two-int array: [0]=bus number, [1]=device address: */
#define LPIOC_GET_BUS_ADDRESS(len) _IOC(_IOC_READ, 'P', IOCNR_GET_BUS_ADDRESS, len)
/* Get two-int array: [0]=vendor ID, [1]=product ID: */
#define LPIOC_GET_VID_PID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_VID_PID, len)
/* Perform class specific soft reset */
#define LPIOC_SOFT_RESET _IOC(_IOC_NONE, 'P', IOCNR_SOFT_RESET, 0)
#endif

There are plenty of hints on usage here, and I was able to grab a little more info after searching for some of those defines in google code search. Using these IOCTLs I wanted to know exactly which modes the USB to parallel converter supported, and try to set it in mode 3, which I hoped would give me more options for talking to the device.

Here is my usblp-hack.c which was able to probe and update these settings, although in my case mode 3 didn’t work, but shows an example of exactly how to do it:

#include "usblp-hack.h"
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>		/* open */
#include <unistd.h>		/* exit */
#include <sys/ioctl.h>		/* ioctl */

main()
{
	int fd;
	int twoints[2];

	fd = open("/dev/usblp0", O_RDONLY | O_NONBLOCK);
	if (fd < 0) {
		printf("Cannot open device.\n");
		exit(-1);
	}

	if(ioctl(fd, LPIOC_GET_PROTOCOLS(sizeof(int[2])), &twoints) >= 0)
		printf("Great success: %d / %d\n", twoints[0], twoints[1]);
	else {
		printf("Fail!\n");
		exit(-1);
	}

	if(ioctl(fd, LPIOC_SET_PROTOCOL, 2) >= 0)
		printf("set protocol to version 2\n");
	else {
		printf("Fail!\n");
		exit(-1);
	}

	if(ioctl(fd, LPIOC_GET_PROTOCOLS(sizeof(int[2])), &twoints) >= 0)
		printf("Great success: %d / %d\n", twoints[0], twoints[1]);
	else {
		printf("Fail!\n");
		exit(-1);
	}

	if(ioctl(fd, LPIOC_SOFT_RESET) >= 0)
	{
		printf("Success reset device\n");
	} else {
		printf("Could not reset device\n");
		exit(-1);
	}

	close(fd);
	exit(0);
}

You can compile the above example just using gcc:

gcc -o usblp-hack usblp-hack.c

You can see in the example above I was able to probe the device to see what mode it was currently in and supports (LPIOC_GET_PROTOCOLS), attempt to set the device mode (LPIOC_SET_PROTOCOL), and soft reset the device (LPIOC_SOFT_RESET).

So in the end, nothing here too complex or mind blowing, but if you are just getting your feet wet it might take you a minute to dig this sort of information up.

Java

It has always been trendy to make fun of Java, and wax poetic about how superior someone’s language of choice is. The fact of the matter is, whether or not you wish to acknowledge it, more users run Java applications on Linux than any other language1.

In the past few years, I have had the opportunity to code multiple enterprise web applications in any language I chose. I made a few in Symfony (php), Django (python), and recently I used Play (java). All of them were fantastic frameworks and languages in their own respect (the only thing people make fun of more than Java is PHP, again generally baseless).

I have used vim for as long as I can remember, but for the Play project I switched over to Eclipse, and that was also a great IDE. A lot of nice features where it would automated a lot of typing, and I found managing multiple files slightly easier.

Point being the language and the tools around it are there, well tested, and ready for prime time. Given the right coder, they are just as effective as any of the trendy languages, and to dismiss that based on outright false statements on most comment threads is absurd.

Performance: Java in no way, in any application I wrote, was limited by the language or jvm in performance. This is generally affected entirely by the coder, not the language.

Adoption: Java is all over my business, and is the clear leader in the enterprise technology stack2

Tools: Tools for Java are abundant, feature rich, and more than adequate to develop complex projects

Criticisms: The only valid criticism is that Java apps are slow to load up initially, for user apps. I think with the innovation we see with respect to JVM performance improvements (JIT compilation etc)3 continuously make that point not even legitimate, but clearly you can make applications load slowly. With that in mind, I have the ability to write a C app that loads slow also.

This post more than anything is to encourage breaking the mold of the group think, “None of us is as dumb as all of us” mentality. No matter how many points you get on reddit for a snarky comment, those points won’t pay your bills, nor give you respect among legitimate coders.

  1. http://www.electronista.com/articles/10/05/26/admob.april.2010.study.has.android.near.even/ []
  2. http://www.forrester.com/rb/Research/of_strategic_languages%2C_javas_adoption_is_highest/q/id/37356/t/2 []
  3. http://www.h-online.com/open/news/item/Android-s-Dalvik-to-be-JIT-boosted-861870.html []

Tags: ,

Tenda W322P Wireless N PCI Card

Purchased this card at Microcenter (http://www.microcenter.com/single_product_results.phtml?product_id=0316296). Out of the box works on Ubuntu 9.10, supports WEP, WPA, WPA2 and has no stability issues transferring large files etc.

Attempted to install the card under Windows 7 x64, x32, and Windows XP SP3, all of which did not recognize the card without additional drivers.

Summary: PCI wireless N card that is Ubuntu compatible with a price under $25
Grade: A+

Tags: , ,

Pygoocanvas, pygtk etc

I was reading a post about PyGoocanvas, and decided to take a look at some code and see what fun could be had. I haven’t done much yet, but this screenshot of it is pretty entertaining in it’s own right:

Looking for someone to give me a hand

Hoping to reach someone intelligent / talented through this. Basically, I need someone for 2 weeks starting 3/8. It will just be a temporary position, with opportunities to work for us later as needed.

Position involves Linux development, and you should know php / perl. The project will involve modems and java also, and the ability to document everything would be great.

Good news about the position is I am leading the project, so anything you can’t figure out, I will. Pay will be somewhere in the $100/hr range, and we need you to be in Cincinnati for the two weeks (3/8 – 3/19), 40 hours per week.

Send me an email (you can find my info in launchpad) or post a comment here if you think you fit the bill. Anyone who has any Ubuntu development experience or contributions to visible projects will definitely take priority. Remember, you need to have the ability to be in Cincinnati, as travel is not covered.

Tags: ,