Archive

Archive for the ‘Unix’ Category

Python @SBP

December 17th, 2010 No comments

My first encounter with python was the embedded scripting engine inside XBMC. The code that came with some of the XMBC add-ons sparked my Python interest to the extent that I picked up a couple of O’Reilly books on the topic and started learning the language.

When I joined Schuberg Philis, a few colleagues had Python skills, but Schuberg’s Python community was too small to ensure maintainability. This didn’t stop me from writing a couple of scripts in places where it made sense to use Python, like automating tasks in a Websphere environment using Jython (no, there is no Jerl ;-) ) and in writing one-off scripts where maintainability was not an issue. As a friendly language advocacy, some of the other engineers jokingly referred to Python as being “Perl for Germans”.

In the meantime more Python enthusiasts joined the company, resulting in more and more useful Python stuff being developed, checked into the repositories and actually being used on a daily basis. This including tooling for:
- Weblogic deployment
- Patch management on RedHat systems
- Reporting on incidents
- etc, etc.

So, all things considered, an in-house Python training looked like a good idea. Based on a one day Python training by Steve Holden I took at LISA2008, we approached Steve for a 2 day on-site training at Schuberg Philis HQ. So last week, this actually happened and about 10 of us joined the training.

After going through the python language features (datatypes, mutable vs immutable, namespaces, assignments, staments, functions, exception, modules, OOP, re module), we spend the last afternoon of the training in a free format discussion, touching an a lot of interesting topics like:
- iteration protocol an generator functions
- Pickling, marshalling and shelving objects
- Kodos, regular expression build and test tool
- Multithreading vs multiprocessing
- Network programming
- Unit testing

Everyone took something different away from the training. Some of my gems are:
- “Pyton Module of the week”, which has picked up a new subscriber
- the fact that there is an XML element tree in the standard library (which saves me from installing LXML all over the place), which was not covered in the 2.2 based “Learning Python book”.

The training was great and has certainly broadened as well as deepened our Python skills. So, if Python is Perl for Germans, I’m, proud to quote JFK in saying “Ich bin ein Berliner” ;-) . Let’s see more Python at @Schuberg Philis in 2011 and beyond!

Categories: Open Source, Python, Scripting, Training Tags:

Damian Conway’s Quantum::Superpositions talk

October 23rd, 2010 No comments

All things considered, Damians Conway’s talk is Yet Another Perl6 Promotion (YAPP), but a damn fun one.  Highlighting some very funky new features that Perl 6 makes happen, in constant time. Theoretically.

Conway is one of the best speakers I’ve seen so far. His talks have speed, passion, a big dose of absurd humor and loads of geek references. If you have the chance to attend one of his talks: go see him, you won’t be disappointed, promise.

The talks starts with a lighthearted refresh of the history of quantum mechanics, unexpected revelations about Bohrs activities in modeling and winter sports and so on.
When the audience is under his spell Conway dives a bit deeper and shows many examples of Perl 6′s more natural syntax, and possible uses of superpositions. Showing how superpositions -called Junctions in Perl 6, are not just reserved for mad scientists. Junctions might be damn useful for programmers; replacing contrived nested for loops with elegant code generating prime’s, testing list membership, doing string comparison, all the while letting Perl take care of parallelization automagically, in constant time. Theoretically.

A very simple example showing the power of superpositions, in Perl 5, taken from the description page of Quantum::Superpositions.pm:

$ideal = any( all("tall", "rich", "handsome"),
all("rich", "old"),
all("smart","Australian","rich")
);

Operations involving such a composite superposition operate recursively and in parallel on each its states individually and then recompose the result. For example:

while (@features = get_description) {
if (any(@features) eq $ideal) {
print "True love";
}
}

The any(@features) eq $ideal equality is true if the input characteristics collectively match any of the three superimposed conjunctive superpositions. That is, if the characteristics collectively equate to each of “tall” and “rich” and “handsome”, or to both “rich” and “old”, or to all three of “smart” and “Australian” and “rich”.

Find a good description of the concepts here, and most of the examples used in his talk on here but you’ll miss the funky Perl 6 rewrites of them. Junctions are documented in the Perl 6 documentation here.

Start using Superpositions/Junctions in Perl 5 by installing the Quantum::Superpositions module from CPAN. The module is currently maintained by Steven Lembark, and will only add the “any”, “all” and “eigenstate” operators. For a more up to date implementation with more junction operators and autothreading fetch Perl 6 by installing Raduko.

Can’t wait until Conway returns for part II: Time::Space::Continuum!

LISA09 #2

December 1st, 2009 No comments

LISA is for sure is sort of event where every geek will find himself like home. It is really good feeling to be surrounded by people who know stuff and enjoy technology everyday.

So LISA09 took place between 1 and 6th of November, 2009 in lovely Baltimore, MD. I chose to follow more the tutorials (trainings) path. Got five tutorials – one bad, two medium and two nice ones. The problem with tutorials is that sometimes they are very basic which I really didn’t expect to be a case on such event.

Read more…

Categories: Conferences, Internet, Lisa, Unix Tags:

LISA 2009

November 26th, 2009 No comments

Already three weeks back from Lisa, and after some gentle stimulation trying to write down my experiences of this event. For the people who don’t know LISA, LISA is the Large Installation System Administration conference, a whole week of talks, trainings and workshops about various subjects all related to the work of unix admins in big IT environments.

From what I understood from people who had been here previously, the attendee list was a lot smaller than previous years. But still, there were more than enough people to share a talk with. It was good to have the opportunity to talk to people working at some big and very known companies like Yahoo, Pixar etc. But also I met some people who worked for less know companies (at least for me) but maybe even more interesting companies, for example, the national democratic institute.  A non-profit organization facilitating democracy in countries where democracy isn’t that natural as in most western countries. I don’t think a lot of system admins have to worry about problems like militia stealing servers from your datacenter.

The first 5 days I followed a set of trainings, some days training for the whole day, some days a morning and an afternoon session. In general I was a bit disappointed by the trainings, they covered a lot of basic stuff, a whole day can be a very long sit for just 2 new bits of information. But a few sessions were quite interesting and/or entertaining.

Read more…

Categories: Conferences, Internet, Lisa, Unix Tags:

Kerberos Based SSO and Apache

June 30th, 2009 No comments

Similar as OpenSSH Authentication Using Kerberos, but now Transparent Kerberos Authentication via Apache against Active Directory using mod_auth_kerb. This enables SSO from IE and Firefox on Apache, IE and Firefox configurations to enable this are also described in the document.

Abstract:  The Apache authentication module mod_auth_kerb allows Apache to authenticate users against a Kerberos KDC including one from ActiveDirectory. Kerberos itself can be fairly complex to set up. This guide will attempt to show the specific steps required to make this possible as well as discuss security limitations specific to the interoperability matters. This guide assumes a basic understanding of Kerberos V and that the Active Directory domain controller is properly configured prior to starting this process.

Technical Analysis: Apache with mod_auth_kerb and Windows Server

OpenSSH Authentication using Kerberos

June 30th, 2009 No comments

An interesting paper on how to authenticate against Active Directory using Kerberos and OpenSSH. This will enable SSO capabilities between Linux and windows, if used in combination with an Kerberos enabled SSH. And maybe even 2-factor authentication if combined with smartcards, haven’t tested this but should be working in theory if you use an SSH client from windows at least.

Components used:

On linux:

  • openssh
  • openssh-server
  • samba-common
  • samba-client
  • krb5-workstation
  • krb5-libs

On Windows:

  • Windows Support Tools

OpenSSH on Linux using Windows/Kerberos for Authentication

Putty With Kerberos

Less is more

June 30th, 2009 No comments

Every once in a while, I resort to one of the many “what’s my IP” type websites to lookup which external IP address I’m currently using. These sites have their uses for both professional, as well as personal purposes. Many of these sites provide a lot more information than I’m really after. In the end, I only want to see my current external IP address.

All the well intended, but known, technical and geo-location info presented by the numerous “what is my IP” sites tends to draw away attention from what you’re after and it doesn’t really play well with tools like ‘curl’ or ‘wget’.

There used to be a simple site I used, which just returned just your IP address located at http://www.whatismyip.org/, but this one also grew a lot of fat. Yesterday, I once again found myself looking for an external IP address, on a server with ‘curl’ and ‘wget’, and decided it was time I rolled what I was looking for myself. This turned into an extremely simple mod_python based scriptlet, which provides a no frills “What’s My IP” service, returning nothing more than a “text/plain” response with your current IP address.

This service is running on my recently upgraded employee rack server at Schuberg Philis at  http://ip.yppy.eu/. For me it provided useful and I hope other people also find this ‘less is more’ service of use. And yes, I will keep it clutter free.

Needs an OO Database but you have “only” Bash?

June 26th, 2009 3 comments

Have a look at this script from Stephane Chazelas appeared in the Appendix A of a very old version of the “Advanced Bash-Scripting Guide”.

#!/bin/bash
# obj-oriented.sh: Object-oriented programming in a shell script.
# Script by Stephane Chazelas.

person.new()        # Looks almost like a class declaration in C++.
{
  local obj_name=$1 name=$2 firstname=$3 birthdate=$4

  eval "$obj_name.set_name() {
          eval \"$obj_name.get_name() {
                   echo \$1
                 }\"
        }"

  eval "$obj_name.set_firstname() {
          eval \"$obj_name.get_firstname() {
                   echo \$1
                 }\"
        }"

  eval "$obj_name.set_birthdate() {
          eval \"$obj_name.get_birthdate() {
            echo \$1
          }\"
          eval \"$obj_name.show_birthdate() {
            echo \$(date -d \"1/1/1970 0:0:\$1 GMT\")
          }\"
          eval \"$obj_name.get_age() {
            echo \$(( (\$(date +%s) - \$1) / 3600 / 24 / 365 ))
          }\"
        }"

  $obj_name.set_name $name
  $obj_name.set_firstname $firstname
  $obj_name.set_birthdate $birthdate
}

echo

person.new self Bozeman Bozo 101272413
# Create an instance of "person.new" (actually passing args to the function).

self.get_firstname       #   Bozo
self.get_name            #   Bozeman
self.get_age             #   28
self.get_birthdate       #   101272413
self.show_birthdate      #   Sat Mar 17 20:13:33 MST 1973

echo

# typeset -f
# to see the created functions (careful, it scrolls off the page).

exit 0
Categories: Scripting, Unix Tags: , , ,