Licence
Creative Commons License

This work by Stephane KATTOOR is licensed under a Creative Commons Attribution 3.0 Unported License.
Feeling like tipping ?
If you find this blog useful, you might consider sending a few bitcoins to support it : 1BTtsC3beGJ6ysd8DhrXjdo6jVw5WD9mvY
RSS
 
RSS Feed
Follow me !
Tech@Sakana on Facebook
Search this site

Newsletter

Get latest posts by email (No spam, only posts):

Enter your email address:

Delivered by FeedBurner

Categories
Monthly archives
June 2013
M T W T F S S
« May    
 12
3456789
10111213141516
17181920212223
24252627282930
MisterHouse : Setting up “modes” - November 13, 2010 by Stephane Kattoor

MisterHouse is a fantastic home automation software with an impressive out-of-the-box feature set, and it only gets better if you know a bit of Perl.

You can conveniently set “modes”, which are settings with states you can define and use. You can then fire events upon state change, and so are they very useful to define some sort of macros.

A few examples :

  • the “Security” mode could be “on” or “off” : setting it “on” would close the shutters and activate the alarm system; setting it “off” would do the opposite;
  • the “Heating” mode could be “day”, “night”, “frost protection only” : setting it on “day” would set the target temperature to 20⁰C, “night” to 15⁰C and “frost protection only” to 7⁰C
  • the “Cinema” mode could be “on” or “off” : setting it to “on” would close the blinds and dim the lights; “off” would bring those back to their former states.

This post will show how to setup a mode, we’ll use the “Heating” mode described above as an example.

read this entry »

Facebook API : Exporting your friends birthdays into vCards format - November 2, 2010 by Stephane Kattoor

The following sample Facebook desktop application exports your friends birthdays in a vCard file format. This file is suitable to be imported into your GMail contacts for example.

read this entry »

Perl : Counting occurences of IP addresses in Apache logs - March 2, 2010 by Stephane Kattoor

This Perl one-liner is intended to print the 10 most frequent client IP addresses in an Apache log file. It can easily be recycled to count anything, though.
read this entry »

Perl+Twitter : Getting @mentions from command line - January 24, 2010 by Stephane Kattoor

This code snippet demonstrates how easy it is to collect your twitter @mentions in Perl, coupled with curl for simplicity.
read this entry »

Perl : Using the Finance::Quote module to get your stock prices - December 30, 2009 by Stephane Kattoor

Finance::Quote is a Perl module which can be used to obtain stock information from various internet sources. I thought I’d rather share this code snippet as an example showing how easy it is to use, before I turn it into a bloatware with an SQL backend to compute average price per share and what not :-)

So here is a simple snippet demonstrating how to get the price of a stock :
read this entry »

D-Bus introduction in Perl - March 8, 2009 by Stephane Kattoor

As stated in Wikipedia :

D-Bus (Desktop Bus) is a simple inter-process communication (IPC) system for software applications to communicate with one another.

This post provides a simple code snippet in Perl to help you getting started with D-Bus programming. read this entry »

Perl : Convert time from Epoch to local time - March 6, 2008 by Stephane Kattoor

watch

This little Perl one-liner can get handy when you need to translate “time in seconds since the Epoch” (for example in logs) to local time :
% perl -e 'print scalar(localtime(1202484725)), "\n";'
Fri Feb 8 16:32:05 2008
%

This was pretty useful today when browsing through Nagios event logs, where times are given in seconds from the Epoch.

By the way, the Epoch is defined as 00:00 UTC on January, 1st, 1970.

Perl : A module to play with a GSM mobile - December 26, 2007 by Stephane Kattoor

As you might have read in my previous post about accessing your cell phone with the AT-commands under Linux.

If not, you might want to start there for a little context.

I finally wrote and released on CPAN a Perl module which will help to automate cell phone operations such as saving/restoring the phonebook or sending an SMS.

Examples are included in the documentation. I believe I made it easy to use, but let me know if I’m wrong :-D .

Features will be added on demand (if possible of course :-) ).

The module is Device::Modem::GSM.

Linux + GSM : How to access your cell phone innards with Linux - December 23, 2007 by Stephane Kattoor

This article explores your options to access your GSM cell phone from a linux system, and manipulate SMS and phonebook entries.

Doesn’t provide hints about how to unlock a GSM cell phone though ;-)

read this entry »

Perl : Optimizing pattern searches with Regexp::Assemble - December 8, 2007 by Stephane Kattoor

When you perform a pattern matching with multiple “or” (|) clauses, such as /pattern1|pattern2|pattern3/, Perl regexp engine will try to match each of them one after the other in sequence, resulting in poor performance if you have a long list of “or” clauses.

In order to optimize such a pattern matching, you can use the Regexp::Assemble module.

read this entry »

Who am I ?
Ads