RSS
 

Posts Tagged ‘Linux’

UIF to ISO files in Linux

19 Jun

Thanks to freshmeat resource:

yum install -y zlib zlib-devel
wget http://freshmeat.net/urls/a179e50646095ae06963e5db6b134c5b
unzip uif2iso.zip
make -C src PREFIX=/usr/local all install
uif2iso foo.uif bar.iso
 

Perl, from Excel to MySQL

10 Mar

One of the reasons I like Perl – it’s really fast on solving daily routines. The request was to get a list of shipping flags from one of the websites to Excel and paste it to the site’s database. Quick and dirty solution:

#!/usr/bin/perl
 
use strict;
use warnings;
use DBI;
use Spreadsheet::ParseExcel;
 
my $file = 'flags.xls';
 
my $xl_parser = Spreadsheet::ParseExcel->new();
 
my $workbook = $xl_parser->Parse($file);
my $worksheet = $workbook->worksheet('Sheet1');
 
my ($c_min,$c_max) = $worksheet->col_range();
my ($r_min,$r_max) = $worksheet->row_range();
 
my @flags;  # used for storing an array of flags;
 
for my $row($r_min..$r_max) {
 
    for my $col($c_min..$c_max) {
 
        my $cell = $worksheet->get_cell($row,$col);
        my $val = $cell->value;
 
        $val =~ s/^\s+(.*?)\s$//g;
 
        push @flags, $val;
        #some extras on different cells/etc/
 
    }   
}
 
my $dsn = "DBI:mysql:database=db_blah;host=host;port=blah_port";
my $dbh = DBI->connect( $dsn, 'usr_blah', 'pwd_blah') || die("Couldn't connect to database\n");
 
 
$dbh->do("INSERT INTO flags(name) VALUES(".$dbh->quote($_).")") for @flags;
 

Memo: fast grep of the word in the directory

02 Nov
 find ./ | xargs grep -i search_string
 

Speed up your work in Vim

09 May

If you don’t know what’s Vim, then:

  1. You’re Windows IDE’s fan
  2. You’ve never used Linux

An option “you’re using Emacs” is not included – you would have definetely known Vim. You’d hate it for the sake of “holly wars”.

I’m not an Emacs lover, neither those huge IDE’s with bunch of boxes, bookmarks, you name it. Most of these things are useless when you need to code something fast, so I just stuck with Vim: simple, light, fast, and have a lot of functionality. Here are just few tips of speeding up coding process I’ve been using lately:

If you got some repetitive function calls or anything you’re not bothered to print just fire up:

Comments:

:ab #cb /********************************
:ab #ce /*******************************/

Printing #cb or #ce will paste initial comment pattern.
:ab #r require_once();
:ab #i  include_once();

Minus another dozen of lines to be typed.

Text search:

You can :set incsearch which will enable incremental search for you, or use regexp, like:
:/\<agent\>/ will find you “agent” in current file.

Using ftp:


cmap ,r :Nread ftp://ftpdomain/public_html/index.html
cmap ,w :Nwrite ftp://ftpdomain/public_html/index.html

These are just basics, Bram Moolenaar, the developer of Vim, got a good article on how to optimize your work with Vim, and David Rayner with his page of Vim tips. Compulsory to learn for Vim beginners!

 

KDE on Windows

27 Jan

KDE on Windows XP

Good news, KDE team started migration of original KDE applications for Windows platform. Concerning windows.kde.org, users of Windows XP/2000/2003 can easily install famous apps like Konqueror, Kate and others on their machines, via KDE-installer.

If some of the applications don’t work from the beginning, just add KDEDIRS and Path in your Control Panel, as it’s described in the manual.

So far, I found only one minor thing: I couldn’t manage applications via Konqueror, however it needs some googling.

In general, lots of positive feelings for this great move of KDE, because some of the apps in KDE can’t be compared with Windows scanty alternatives.

 

Linux Antivirus

17 Jan

Here is a Linux Virus scanner for you:

!# /bin/bash
echo Linux virus scanner
sleep(1)
echo Scanning now...
sleep(10)
echo Still scanning...
sleep(10)
echo Almost done...
sleep(5)
echo Drum roll...
sleep(3)
echo No viruses found!!!
sleep(1)
echo Done

References go to Ubuntuforums

Updates: First add-on for Linux Antivirus released, just add few lines at the bottom of the code:

eject
play tada.wav

 

7.04 to 7.10 Ubuntu desktop

22 Oct

Heck! I was expecting some power consumption improvements, but still 4 hours XP vs. 2 hours Gusty.

Trying to make this post useful, follow these lines:

sudo aptitude update
sudo aptitude upgrade
sudo aptitude dist-upgrade

And remember: the more you misspell these three lines the longer upgrade will be! Be aware of grammar mistakes, folks!

 

Licenses, patents and ideas

17 Oct

I’ll try to make things short by quoting Richard Stallman:

Control over the use of one’s ideas really constitutes control over other people’s lives; and it is usually used to make their lives more difficult.

Watching these patent wars between Novell, Red Hat versus IP Innovation just makes me wondering: how hard will it be to distribute ideas in the world where everything is patented?