Sunday, December 25, 2011

Revisiting Windows 7 - Package management is possible

After a very long time I did not use Windows for my private needs, I have finally found the times to take a longer look on Windows 7. I have decided to install the operating system on a real machine to see it's real behaviour and interaction with plastic and iron.
Here are a few quick observations. The installer is WAY better than Windows XP. I have no clue how it was in Widows Vista. Unfortunately Windows still requires a lot of reboots until the process is done. It took about 1hour to complete the installation, and after that I feared I will have to click hundreds of next next next to finish the process of configuring the hardware and installing software to make the Laptop usable. Fortunately, I kept the disk of drivers which came with the laptop when I bought it. The auto installer just did the job with out to much pain. My next step was to google and find if there is already a DECENT Package manager for windows. Guess what ? there are a few of them. And after testing a little bit I settled on NPacked. It is not perfect, but it made the computer somewhat more reach with software with relatively little pain. My biggest criticism on it, is the sparse collection of software available, and the fact that it does not read local XML file, only those hosted on some webserver. I hope posting here will publish NPacked somewhat more and help it gain more software to the repo. Unfortunately, this project seems like a one man show, which does not really ensure the sustainability of this project.
There is not much more to say. I am not so eager to use that OS, but I have to make myself some what familiar with it.

Monday, December 12, 2011

The more I read on GNOME 3 I get more mad

The idea I need to learn X Programming Language (e.g. JavaScript) in order to customize my desktop is IMHO simply IDIOTIC! Although I love learning programming languages, and I am a programmer, I DON'T WANT to program my desktop. My desktop is not a problem I need to solve. It should just work.

Have you ever seen a customized Gnome Shell? You can do quite a lot, and practically anything if you know javascript.

The quote is from the Debian forums.

If I wanted to program my Desktop, I'd probably learn Lua and use something crazy like AWESOME WM (But in the mean while I'm fine with DWM and GNOME 2.30).

Sunday, December 11, 2011

Short news about the GNOME 2 fork

Well, I've been following the Development of Mate DE quite closely  via github and it seems like the project is gaining momentum. It gained the support of Linux Mint Dev's and now it has it's own website, so I'd like to give here the link to the GNOME 2 Desktop alternative, in hope more peope will contribute and join.le will contribute and join.
Since there is now a Debian repository for MATE DE, I intend to test it hands on, and not just observe from the side.

Saturday, December 10, 2011

The Wierdest Post Ever in ServerFault.

I don't know if this is a joke or not. But if it's not a joke, it must be cruel. Just take a look on that guy's question and look at the answers.
This is probably the worst system administration task.

Saturday, November 19, 2011

No more MONO on Ubuntu

Well, it's a quite a late response, but it ought to be. After Ubuntu has shoved Mono down our throats for quite a while, they have decided to retreat from it. As of Ubuntu 12.04 there will be no more Mono on the default install CD.

I want to curse Ubuntu devs for their actions so far, but their decision to drop Mono, for what ever reason, is a considered a blessing by me. I might even give it a spin again in 12.04 after about 2 years of not touching Ubuntu.

Wednesday, October 26, 2011

Analyst my S

Sometimes I just can't wonder ... An idiot posts a blog which shows the guy has no clue what he's talking about. And people actually make such a fuss about it.

The guy writes here:

Sure, Android is built on top of Linux, but Linux is only one of many piece parts of the Android mobile operating system. It is not Linux.

Anyone who knows what a Linux distribution is, would agree that no Linux distribution is Linux according to this definition. 

So, Mr. Analyst my S. Next time I meet people with your title, I will seriously think how I should tag them. I would even bother suggesting this guy takes a "Non-Linux" like Debian or Ubuntu for a try. Idiots like this guy deserve to punished for the rest of their lives sitting in front of a computer with Windows 7. 

Sunday, October 23, 2011

More GCONF Fun: Setting display backlight

In my Clevo notebook all the Fn keys work, except the Brightness keys. So,
after search quite long, I have found that the only solution that really works for me
is "xbacklight".
So, here is how to map the "Special Key " and alt together with F8 and F9 to reduce or
increase screen brightness.
First, install xbacklight:
aptitude install xbacklight
Decide where you want the custom script to reside (see bellow) and export the following bash variable:
export PATHWHEREYOUWANTYOURSCRIPT=/usr/local/bin/increasebacklight.sh
Then create custom keybindings:
#setting to decrease
gconftool-2 -s /desktop/gnome/keybindings/custom1/action -t string "xbacklight -dec 14"
gconftool-2 -s /desktop/gnome/keybindings/custom1/binding -t string "F8"
gconftool-2 -s /desktop/gnome/keybindings/custom1/name -t string "Reduce Backlight"

#setting to increase backlight
gconftool-2 -s /desktop/gnome/keybindings/custom2/action -t string "$PATHWHEREYOUWANTYOURSCRIPT"
gconftool-2 -s /desktop/gnome/keybindings/custom2/binding -t string "F9"
gconftool-2 -s /desktop/gnome/keybindings/custom2/name -t string "Increase Backlight"

And finally, setup the the script which increases the screen brightness:


#note: if you chose like me /usr/local/bin/increasebacklight.sh
#run the following as root.
#you can also have it in ~/bin/increasebacklight.sh, just make
#sure ~/bin/ is in your PATH

cat >> $PATHWHEREYOUWANTYOURSCRIPT <<EOF
#!/bin/bash

# a simple script to avoid the fact 
# that it is impossile to increase 0 precent
# by add more precent ...

LEVEL=`xbacklight -get`

if [ $LEVEL == "0.000000" ]; then
    xbacklight -set 15
else
    xbacklight -inc 15
fi
EOF

chmod +x $PATHWHEREYOUWANTYOURSCRIPT

That is all.

P.S.
Yariv,
If you are reading this, thanks for introducing me to xbacklight.

Wednesday, October 19, 2011

When friends spit FUD

Warning: This is not a technical post, rather just a boring rant and a call for advice. A friend of mine asked me what programming language he should learn. He was thinking of dwelling into modeling after doing some programming with R and Matlab. Then, I suggested he should give Python a spin. I think python has much nicer syntax than R or Matlab. Regarding speed, I have seen many many times that Python is simply faster than Matlab and R when using modules written in C or Fortran (which is the case for Numpy and most of scipy). And finally, both R and Python are FREE, so their amount of packages is extensive so every user has a great choice of ready made recipes. So, it seemed my friend was kind of convinced and thought of trying Python. But a couple of days later, when we chatted, he told me the following sentence:  

"2. anything that's open source is inherently less user friendly than commercial products."

Now, I am a dickhead, so I get mad when friends of mine, whom I consider to be smart, say stuff like that. Especially, when they sound so convinced. If you read my blog, you are likely to label this sentence as FUD. And you are likely to disagree like me. Personally, I don't know how to change a man's opinion who is so convinced. I also don't know if I should try. But it sure does piss me off and sets me on angry mode. It would be nice to know what other people do in such cases. I just don't want to be an evangelist anymore.

So, please give me and advice how to fight FUD when it comes from friends you really love.

Finally, apologies to my friend who got quoted without reference, and had to experience me getting upset.

Thursday, October 06, 2011

Another crack in the Windows hagmony

For about 4 years now there is a possibility to get a Netbook with Linux. Now, there are many of them coming with Android and Meego. Asus has been shipping Linux for quite some times. Unfortunately, always as a second citizen in it's laptops. The better models always come with Windows. IMHO, it's stupid, because WIN7 just kills the system - i.e. WIN7 Boots slower than WINXP although the hardware today is MUCH faster. But back to what I wanted to write about. Today this really caught my eyes browsing some laptops:

A Windows agnostic "WIN" button. I've seen that already in laptops which come with Ubuntu pre-installed, but first time I see it with a main line manufacturer! Such a shame that the same model which comes in white does have the Win button. The laptop by the way is ASUS Eee PC X101-BLK022G which comes pre-installed with Intel's Meego Linux distribution.

Monday, October 03, 2011

Quicktip: make gedit more sane

Continuing the agile setup of GNOME desktop using gconftool-2. Here's a snippet to make tab width 4 spaces, insert spaces instead of tabs and enable automatic indentation:
gconftool-2  --set /apps/gedit-2/preferences/editor/tabs/insert_spaces --type bool 1
gconftool-2  --set /apps/gedit-2/preferences/editor/tabs/tabs_size --type int 4
gconftool-2  --set /apps/gedit-2/preferences/editor/auto_indent/auto_indent --type bool 1
Well, GNOME 2 isn't that evil. Let's hope the Mate Desktop Environment really catches.

Tuesday, September 27, 2011

Quicktip: Setting keyboard layout in GNOME via CLI

Since I tend to break my installation quite often while testing new stuff, I'm always looking for more agile way of re-setting my system quicky. Of course backups could do the job, but I find a clean install much cleaner and safer for my purposes.
So, here is a tip how to set keyboard layouts from the command line using GNOME - very useful if  you speak more than one language:


gconftool-2  -R /desktop/gnome/peripherals/keyboard/kbd
gconftool-2 --recursive-unset /desktop/gnome/peripherals/keyboard/kbd
gconftool-2 -s /desktop/gnome/peripherals/keyboard/kbd/layouts -t list \
--list-type=string [us,de]
gconftool-2 -s /desktop/gnome/peripherals/keyboard/kbd/options -t list \
 --list-type=string ["grp	grp:alt_shift_toggle,terminate	terminate:ctrl_alt_bksp"]
Do notice: there are TABS in the empty spaces up there. GNOME's xml was intolerant for my attempts to replace them with spaces, and really only worked with the braces.

Monday, September 26, 2011

Linux users: stop whining about UEFI Secure booting!

Sorry for the provocative title, but I think Linux and other FOSS Operating System should really stop whining about the UEFI secure booting.
I see no difference between someone who buys a laptop made by Apple and a someone who buys a Laptop with Windows OS. As the saying goes: "If you sleep with dogs, you wake up with flees". For a very long time the Linux Community ignored the WINTEL monopoly and did very little to support free hardware manufacturers. Many people would invest tons of time in hacking and patching Linux and drivers where they where manufacturers ignored deliberately or unintentionally Linux.
I don't buy hardware very often. And so most people who use Linux don't need to. But when I do buy hardware or asked to recommend hardware, I never do buy anything with Windows, or NVIDIA, or ATI.
I won't even answer friends or family question in the style "can you recommend this WinLaptop or that WinLaptop?". Sounds extreme, I know. But in fact, my strategy works. I have successfully bought my own Laptop from a small company that sells Clevo laptops with out windows. And more than 5 friends of mine who saw "Linux Just Works" out of the box, decided to buy these laptops too. I think it shows that there is a Market for people who are not interested in Windows. Even if it is small, it is growing.
But besides looking for a Laptop which does not come with Windows. You can specifically buy Hardware from manufacturers that do support Linux. Nowadays the ARM architecture is  rising, and provides computational power which is enough for most home users. In fact, the beagleboard provided more computational power than my 6 years old Laptop which still works. Not only that, the architecture is completely open, so I know, no UEFI Secure boot will shit on my head from the manufacturer.
There are a few more hardware manufacturers which make nice and OPEN hardware. To mention a few:
gumstix, opencircuits, hawkboard, pandaboard, igep and even more.
And there is even a whole Laptop/Tablet based on beagle board. 
You might mock the  "lousy" or humble hardware offering in this free field. But in fact it is enough for text processing and multimedia. It is enough for me, and I know, my next laptop, will be based on ARM, because I give a #!$% about UEFI, and I don't care what Microsoft does. Instead of fighting it directly, I will give my money to companies which promote my computational freedom.
I hope this post will encourage at least one extra person to re-consider his next WINTEL/AMD/NVIDIA buying.


Saturday, September 10, 2011

How to: Bluetooth Speakers without Pulseaudio

About 3 months ago I have purchased a Bluetooth Speakers set. I chose the Creative Labs D200, which provide me with nice tunes compared to the prices. The speakers worked out of the box with my Bluetooth adapter. Pulseaudio also makes life easier to switch between the laptop's own speaker to the Bluetooth speakers. However, I get irritated sometimes with pulseaudio, and I was looking for an alternative solution.

After researching a few different sources I have come up with my own flavor of solution, which I document here for future benefit of myself and others.

Thursday, August 25, 2011

20 Years of linux - a humoristic view

From an Israeli Linux forum:

<KingYes> Today, 20 years ago, Linus announced he is working on a new operating system
<KingYes> http://groups.google.com/group/comp.os.minix/browse_thread/thread/76536d1fb451ac60/b813d52cbc5a044b?pli=1
<KingYes> This is Great, how time passes by.
<Haimn> WOW I didn't know his post still exists.
<Guest> In windows it would not happen...
<KingYes> What would not happen?
<Guest> Your lack of sense of humor.


Credit: Original Link in Hebrew


I found it amusing, so I think it was worth a translation. I tried submitting to bash.org, but it does not work ...

Wednesday, August 03, 2011

A Usefull PyGTK Example

I have been looking for a good pygtk tutorial for a very long time. I have found a few tutorials which where an overkill, so I don't link to them. By over kill I mean that they where full with details which prevented me from actually having an application working.
I found this nice pygtk tutorial, which is actually more a capabilities demonstration. After reading for a few hours, I got intrigued. But I was very frustrated since the tutorial does not produce any real life example. For example, I would have expand the calculator example to working one. I did a Google search and bumped into this pygtk calculator working example. After a couple of more hours, I have managed to produce the following "Hello World!" pygtk application which demonstrates some basic pygtk principles:

#!/usr/bin/python

# A Usefull and Active PyGTK Example
#
# This example demonstrates a few Widgets which actually do 
# some stuff, and interact with each other.
#
# oz nahum
# linuxpixies.blogspot.com 
# August 2011

import gtk

class PyApp(gtk.Window):

    def __init__(self):
        super(PyApp, self).__init__()
        
        self.set_title("Entry")
        self.set_size_request(250, 200)
        self.set_position(gtk.WIN_POS_CENTER)

        self.fixed = gtk.Fixed()

        self.label = gtk.Label("Please Enter Your Name below")
        self.fixed.put(self.label, 60, 40)
        
        self.entry = gtk.Entry()
        self.entry.add_events(gtk.gdk.KEY_RELEASE_MASK)
        self.fixed.put(self.entry, 60, 100)
        
        self.entry.set_text("bla")
        self.UserName=self.entry.get_text()  

        self.outlabel=gtk.Label('name')
        self.fixed.put(self.outlabel, 60,180)
        
        self.button = gtk.Button("Greeting:")
        self.fixed.put(self.button, 60,140)
        self.button.connect("clicked",self.greeting)
        
        self.clearbutton = gtk.Button("Clear")
        self.fixed.put(self.clearbutton, 140,140)
        self.clearbutton.connect("clicked",self.cleartxt)
       
        self.button = gtk.Button("Close")
        self.button.connect("clicked",gtk.main_quit)
        self.fixed.put(self.button, 200,140)

        self.connect("destroy", gtk.main_quit)
        self.add(self.fixed)
        self.show_all()
        
    def greeting(self, event):
        self.outlabel.set_text("Hello "+self.UserName)
        self.entry.set_text('Hello '+self.UserName)
        
    def cleartxt(self, event):
        self.entry.set_text("")

PyApp()
gtk.main()

Tuesday, July 05, 2011

GNOME Fork revisited

Since I posted in my blog about GNOME 2 fork, I have seen numerous hits. In 4 months since than,
this single post had more than 3 times hit compared to my second most popular post about TMUX copy mode.
Yesterday, I bumped into a young fork of GNOME 2, called matte. Named after the Argentinian herb infusion. Let's hope this project will not have a bitter end like the drink, and rather long sweet life. The odd choices of developers are sometimes annoying. While it might seems narrow minded of me, I do expect a project that aims to be the size of GNOME2, to write a document or two in English. He, but what do I know there are actually more Spanish speaking people. I should learn Spanish instead of blogging...
I will try Mate sometimes probably.But in the mean while, thanks to GNOME developers I have been looking into alternatives and found my own peace within DWM, and now I am building my Desktop from Scratch.


Friday, June 24, 2011

dwm Baby, Hell Yeah I am becoming a SUPER GEEK!

F#!k yeah! I am using a tiling window manager called DWM, and it is the best thing I have seen lately. Easy to compile, easy to use, and there is no mouse involved, my hands are not painful anymore after a work day (well, they do, if I go climbing...).

That said, I am also using Pentadactyl which negated the mouse usage also in side Firefox.
My hands will thank me for that in 40 years. No more painful joints....


Tuesday, June 21, 2011

The best latex editor Kile 2.1 Released!

This should be really bigger news! Although I don't use KDE at all, Kile is the best editor for Latex, I have tried. The developers released 5 beta versions before, which never gave me any problem.
11 Days ago, kile 2.1 was finally released, here is the release announcement .
I love how simple Kile is, although it is full with goodies and options. I love how it is out of the way when you want it. I tried contributing to Gummi-latex editor. But eventually, I found it useless.
I love the VIM mode in Kile, and I wish it was possible in some GTK+ Editor. Yeah, I know I can use vim-latex-suite. But I am too lazy to learn it :-). So, I use vim for all other programming, and Kile for Latex.
So, bottom line, I really recommend to download and install latest Kile!

Sunday, June 19, 2011

One more python learning resource

This one is pretty cool. It is a learning environment, which allows you also to create more learning environment. I wish I had more time to play with it!
Python Crucny: http://code.google.com/p/crunchy/

Have fun!


Monday, June 06, 2011

TMUX - copy mode and how to control multiple servers at once

Two tips which needs to be documented:

The first one is how to copy in tmux, which had me struggling a lot. Most places say that you need to type the following sequence:
CTRL+a,[ (note my prefix is CTRL+a instead if CTRL+b).
Then something tricky happens:
In some servers I found out that selection of text is initiated with either SPACE or CTRL+SPACE. So, try one of them.
Navigate with the ARROWS to select the text.
Than, copy the selected text with CTRL+W (or ALT+W if that does not work).
Now, navigate to the desired place where you want to paste the text and type the following sequence:
CTRL+a,].


The second tip is how to control multiple servers with TMUX:
First, export a variable called HOSTS holding your servers list, e.g.:
HOSTS="host1 host2 host3 host4 host5"
then run the following script in your BASH:
#!/bin/bash
# ssh-everywhere.sh

# a script to ssh multiple servers over multiple tmux panes 

usage() {
    echo
    echo
    echo "Application Call: "
    echo
    echo "$BNAME sessionname"
    echo "before calling the script do: export HOSTS='host1 host2 host3'"
    echo "as a list of hosts to work on, or you will be promted to type"
    echo "the list in." 
}

starttmux() {
    echo 
    echo $HOSTS
    if [ -z "$HOSTS" ]; then
       echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
       read HOSTS
    fi
    
    tmux new-session -d -s $sessionname 
    for i in $HOSTS
    do
    tmux split-window -v -t $sessionname "ssh $i"
    tmux select-layout tiled
    done
    #tmux set-window-option synchronize-panes on
    tmux attach -t $sessionname 
}

BNAME=`basename $0`
if  [ $# -lt 1 ]; then
    usage
    exit 0
fi

sessionname=$1
starttmux

That is all about TMUX for now.

P.S.
After a long struggle again, I found out how to copy paste in VI mode with tmux:
SPACE, stars selection.
CTRL+m copies to buffer.
CTRL+a,] pastes the buffer.



Sunday, May 29, 2011

The future of Windows

Last week I participated in a Windows 7 course. I was sent to the course by my employer, although in my official role is Linux System Engineer. 9 people attended the course. Looking around my colleagues I had some interesting observations, I'd like to share.
First of all, among the participants, I was the youngest. 2 Other guys where also Linux admins, the rest were Windows admins. Some external appearances really struck me. Usually, Linux guys have the image of being wild hairy beasts with long unshaven beards. Well ... there are some differences with the Windows guys, but not what I expected:
  • All the Linux guys were younger then 35, windows guys are older. This is a very strong indicator about the future of this OS.
  • The Linux Guys (including me) dress sportive casual stuff, short pants, some sport brand cool shirt or just plain T's. Windows guys are dressed business casual: jeans or some fancy pants, with a button up shirt tucked in their pants behind some leather belt usually holding a role over fat stomach.
  • Linux Guys come to the course cycling (MTB or Road bike), Windows guys all came with a Car, which can explain the fat stomach phenomena.
  • Out of 6 guys, 3 guy actually had facial hairs, and our instructor a mustache! Personally, I find people with mustaches unreliable.
This are just my few observations on being in a Windows 7 course.

Another anecdote I have noticed while learning Windows 7, is it's lousy backward compatibility. Windows 7 does not include Solitaire or Minesweeper, at least in the VM's we had ... Imagine, passing 2 days in front of the most boring OS, without minesweeper...


Thursday, May 26, 2011

2 Cool Python Learning resources

A couple of nights ago I was browsing code.google.com in random search for interesting Python projects.
Here are two nice catches from my random fishing, which are worth mentioning. The first one is a Free python book, which attempts to bring Python and the joy of creating software for kiddies, here is what they write as an intro:

"Snake Wrangling for Kids" is a printable electronic book, for children 8 years and older, who would like to learn computer programming. It covers the very basics of programming, and uses the Python 3 programming language to teach the concepts.

The second one, is a Python interactive learning program. Although I have not played a lot with it, it seems fun. However, the project seems a little bit sleepy (no updates for almost a year):

RUR-PLE is an environment designed to help you learn computer programming using the language Python. Within an artificial world in which a robot can be programmed to perform various tasks, you will learn what it means to write a computer program, using Python's syntax

If you are a self learner type like me, you would appreciate these resources.



Tuesday, May 24, 2011

Building Octave-3.4 on Debian Sid

I wanted to build the latest Octave (3.4) on my Debian Sid. Well, it wasn't as easy as before, since I upgrade it quite often. So now, the GCC-4.6 is used in Octave. However, due to some bugs in GCC-4.6 or Octave(?), it won't build. So, the trick that did it for me:

sudo aptitude build-dep octave3.2
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
sudo aptitude install gcc-4.5 gfortran-4.5 g++-4.5

than, we need to do something ugly, but it does work ... ;-)

sudo mv /usr/bin/gfortran /usr/bin/gfortran.ORG
sudo ln -s /usr/bin/gfortran-4.5 /usr/bin/gfortran

now we tell Octave to build using GCC-4.5:
export CC=/usr/bin/gcc-4.5
export CXX=/usr/bin/g++-4.5

the rest is easy:
./configure
make 
make test
sudo make install
sudo checkinstall

Et viola! A post which is more positive and not ranting! Octave 3.4 is faster, and provides better Matlab comparability. Give it a try and you want look back!



Friday, May 06, 2011

More UNITY Crap

Take a loot at this post. You need a "how to" to run multiple copies of the same program. Hmm... Ubuntu is turning Linux boxes into IPHONES who are locked down to run one application at the time.
Idiots. We have multicore processors, and more multithreaded applications, but Ubuntu users need a how to if they want to open two instances of GEDIT for example if they want to compare two documents, and NOT use TABS.
Honesty, the title of my previous post was "Are Linux developers getting dumber" maybe I should not have censor myself.


Better Apps in Linux

I don't know why, but I have the feeling that the rise of Ubuntu, does not bring Linux forward. I have read a few posts about it. And I think that the focus of Linux developers is starting to annoy me so much that I am thinking of ripping Linux off my Laptop and just installing *BSD, although I'd have to twitch my nose, because I prefer GPL over BSD.
My rant is about things like GNOME3, KDE4, UNITY and stupidities like systemd. The first two idiotic examples are a proof of how FOSS developers can be totally disconnected from their users. I mean, KDE4 and GNOME3 both seek to re-invent the user experience. However, the firm hold of windows in the market, shows that user experience is not such big deal. Rather, I think, applications and stability are more important.
True, Windows suck big time. I hate the thought of using such a flawed OS. However, Windows Jane and Joe, don't care. They just want their Photoshop and Adobe Acrobat to work. And while cool Dave has his Unity blowing off cool effects, he can't properly annotate PDFs, while GNOME and Ubuntu developers are still fighting if the awesome bar should be in the bottom of the screen or on the left side.
Systemd, sounds really like an amazing piece of software, which can really fly my laptop to mars upon boot. However, I boot my computer only once in 2-3 months, when I upgrade my kernel, and frankly, I don't care if it takes 2 minutes to boot. The same is true for all Windows 7 users.
Last week, I was riding the train, and the guy next too me booted his Windows XP - took him 5 minutes until he got to his email software. But you know what ? When he did get to it, it worked.
I am at the point, that I am using Linux for 5 years now, and I will never install Windows on a friend's computer. However, I feel that Linux apps really annoy me sometimes. And this week, I just discovered it again, while downloading a PDF with FORMS, which only worked with ADOBE READER for Linux. Evince and Okular the two leading FOSS PDF readers just failed to fill the forms and save the document. Now you can tell me, I can open bugs - which I did (2 and 3 years ago) and they are still not attended, because like I said, the BAR and Desktop effects are more important. Of course, I can role my sleeves up, and put some effort and code it. But at the same time, I can just apt-get ADOBE Reader from Debian's non-free repository.
I hate that last option, and I wish it was the other way. So if some one in GNOME or KDE reads this post, please, forgot about stupid stuff like the SHELL or PLASMOIDS, we don't care about that crap. We want applications that can do more, for less memory, and for less CPU, that will be stable, and have more features than their WINDOWS counters. And then people will come.
This is also trough, not just for PDF reader, but to ALL KINDS of commercial software which abundant for WINDOWS but lack for Linux. The gaming industry has picked it up, and the picture is starting to change. Next I hope to see CAx software, accounting and banking, medical software and more. When these will come, it won't mater if Linux will have Plasmoids or Unity or the SHELL.
Want a Proof ? Look at MacOS, although it is a FAR better operating system then WINDOWS, it stayed always in a niche. Why ? Because Apple played close, and developers did not develop commercial apps to it, compared to the amount of apps available for Windows. Of course, commercial, does not have to be closed source. On the contrary, commercial should be open too.
But that is for another post.
I'll sum up, forgot the decorative stuff like SHELL, PLASMOIDS or UNITY. Give us better applications, better than WINDOWS, and people will rush to LINUX.


Sunday, April 17, 2011

Calcurse, a compact Linux organizer, now with encryption ...

I bumped into calcurse a while ago, but I didn't take the use of it seriously. When I started using it, I was also using Gnome's Evolution. But than, times changed, and I didn't need a calender anymore, so I gradually quit using Evolution. When two weeks ago I decide to organize my life on the computer again, I decided I would like to have a portable application I could carry on a USB stick. There was calcurse, which produces a very compact executable which I can carry around. Since it uses plain text files which are easily editable, I can also edit them on other operating systems without any problem.
So there you have it. A small great lightweight calendar application: Calcurse !

As a bonus to myself I decided to play with the idea, that I would like to encrypt the data I have on my disk on key, since it is possible that I loose my USB with lots of customers private data. So I wrote the following script, which launches the binary from the USB, decrypts the data folder, and then upon closing Calcurse would archive the data directory, encrypt it, and move it back to the USB.

Notice the following things:
1. I use OpenSSL, this is probably lame, and I should use GPG key.
2. You have to do a few steps manually before you can use the script, you will find them in
the body of the script below as comments.




#!/bin/bash

# ENCRYPTCALCURSE.SH

# Written by Oz Nahum 
# This script is distributed under the terms of the GNU Public License 
# Version 3 or later.
# You can obtaion copies of this license at:
# http://www.gnu.org/licenses/gpl.html

# A script to decrypt the calcurse_date dir, open it in 
# /home//calcurse_data
# then launch calcurse pointing to it, 
# and upon closing calcurse, encrypt the data, move it to usb stick, 
# and delete all data from /home//calcurse_data

# these commands needs to be run manually at first
# 1. make calcurse files only readable by owner
# $ chmod -vR 600 calcurse_data
# 2. creat a tar archive of the data:
# $ tar -cf calcurse_data.tar calcurse_data
# 3. encrypt the archive:
# $ openssl aes-256-cbc -salt -in calcurse_data.tar -out calcurse_d.tar.enc
# 4. copy calcurse binary from your system to the USB key
# $ cp -v `which calcurse` 
# 5. copy the encrypted archive to the USB
# $ cp -v calcurse_d.tar.enc 
# 6. finally, copy the script itself to your USB, and launch:
# $ bash encryptCalcurse.sh

### Begin of Script
#make files readable only by owner
umask 077
trap "find /dev/shm/calcurse_data -type f | xargs shred -fuz;
      shred -u -n 3 -z /dev/shm/calcurse_data_tmp.tar
     " SIGHUP SIGINT SIGQUIT SIGABRT SIGKILL SIGTERM
# first decrypt the data:
openssl enc -d -aes-256-cbc -salt -in calcurse_d.tar.enc -out /dev/shm/calcurse_data_tmp.tar

echo "extracting data"
#silently extract data, no need for verbose output (v flag)
tar -C /dev/shm -xf /dev/shm/calcurse_data_tmp.tar
echo "removing temporary data"
#remvoe the temporary archive
shred  -u -n 3 -z /dev/shm/calcurse_data_tmp.tar
sleep 3
#launce calcurse
calcurse -D /dev/shm/calcurse_data
# when calcurse is done tar the direcotry

tar -cf /dev/shm/calcurse_data_tmp.tar -C /dev/shm calcurse_data
#tar -cf calcurse_data_tmp.tar calcurse_data/

# then encrypt
#if encryption failed $? == 1 so repeat it again ...
openssl aes-256-cbc -salt -in /dev/shm/calcurse_data_tmp.tar -out calcurse_d.tar.enc
es=$?
while [ "$es" = "1" ]; do 
    echo "encrypting data"
    openssl aes-256-cbc -salt -in /dev/shm/calcurse_data_tmp.tar -out calcurse_d.tar.enc
    es=$?    
done
#if encryption succeeded remove the tar file
find /dev/shm/calcurse_data -type f | xargs shred -u -n 3 -z 

rm -rf /dev/shm/calcurse_data
shred -u -n 3 -z /dev/shm/calcurse_data_tmp.tar
#copy the encrypted file back to the USB
#mv ~/calcurse_d.tar.enc .

#note about the salt option note found in openssl man page[1],[2]
#note about lack of compresion with ssl [3]

#sources:
#[1]http://ubuntuforums.org/showpost.php?p=8287351&postcount=9
#[2]http://linux.die.net/man/1/enc
#[3]http://serverfault.com/questions/17855/can-i-compr:ess-an-encrypted-file

Friday, April 15, 2011

Stripping EOL from output in BASH

Sometimes you have to text process the output of many chained commands, e.g. bash command to list all dev package in Debian. The results are usually outputted with "\n", e.g.

output1
output2
output3
output4
If the list is long enough your screen will scroll, and it will be hard to control the output without less. A solution is to strip the EOL marks with echo, for example compare:
getent passwd | cut -f 1 -d ":"
to:
echo $(getent passwd | cut -f 1 -d ":")

Sunday, April 03, 2011

Turn your laptop to alarm clock

I bumped into an article describing rtcwake here, so I thought it will be cool to write a nice wrapper script around it.
It was also an excuse to master some more bash scripting and the use of "date" command.

There are many many other implementations for rtcwake script, like here for example, and I've seen some other cases in the Ubuntu forums, after I finished writing mine. So with out further a do, here is my solution, which is easy to use:

#!/bin/bash

#       GoodMorning.sh
#       
#       Copyright 2011 Oz Nahum <nahumoz_ATTNOSP_gmail.com>
#       
#       This program is free software; you can redistribute it 
#       and/or modify it under the terms of the GNU General 
#       Public License as published by the Free Software 
#       Foundation; either version 3 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will 
#       be useful, but WITHOUT ANY WARRANTY; without even the
#       implied warranty of MERCHANTABILITY or FITNESS FOR A
#       PARTICULAR PURPOSE.  See the GNU General Public 
#       License for more details.
#       

if [ $5 ] && [ $5 !=  "test" ]; then
    PLAYLIST=$5
    PLAYER=$4
else
    PLAYLIST=$4
fi

if [ $PLAYER ] && [ $PLAYER = "mplayer" ] ; then
   PLAYER="mplayer -playlist"
else
   PLAYER=$4
fi


#echo "player is" $PLAYER
case "$1" in

    "")
        echo "  usage: GoodMorning.sh --help to see this how to use that script"
        exit 1
        ;;
    
    "--help")
        echo "  GoodMorning.sh [--set|--configure]   "
        echo " "
        echo "  Options:"
        echo "  --set"
        echo "  --configure"
        echo ""
        echo "  GoodMorning.sh --set   [player|playlist]"
        echo "      will set the correct time for the script to wake the computer "
        echo "       with a lovely playlist."
        echo " "
        echo "  GoodMorning.sh --configure "
        echo "      will add the specified  to the sudoers list, so that rtcwake" 
        echo "      can be called without promting for password. This option is not yet"
        echo "      implemented. This option is only available with sudo or as root..."
        ;;  

    "--set")
        IN=$3
        arrIn=(${IN//:/ })
        
        echo "will set up wake up to ${arrIn[0]}:${arrIn[1]} $2"
        TODAY=`date +%F`
        TODAY_IN_SEC=`date --date=$TODAY +%s`
        TIME=`date -d "$2 00:00:00" +%s`
        
        WAKE_UP_TIME=$(($TIME+3600*${arrIn[0]}+60*${arrIn[1]}))
        
        echo "date to wake up" `date --date "1970-01-01 $WAKE_UP_TIME sec" "+%Y-%m-%d %T"`
        # check if testing mode
        if [ "$5" = "test" ] || [ "$6" = "test" ]; then

            echo "testing only", $PLAYER, $PLAYLIST
            sudo rtcwake -t $WAKE_UP_TIME -m on -v && $PLAYER $PLAYLIST         
        else
            sudo rtcwake -t $WAKE_UP_TIME -m mem -v && $PLAYER $PLAYLIST        
        fi
        ;;
    "--configure")

        if  [[ $EUID -ne 0 ]]; then
            echo "This script must be run as root" 1>&2
            exit 1
        fi
        
        echo "Will add user " $2 "to sudoers file so that,"
        echo "$2 will be able to call it without password"
      
        echo "$2 ALL= NOPASSWD: /usr/sbin/rtcwake" >> /etc/sudoers
        ;;
esac


Saturday, April 02, 2011

Remove all Development packages from Debian

Another cool one liner to remove all development packages to clean your Debian.

$ aptitude remove `dpkg -l | grep -e \-dev | sed 's/ii//g' \
| sed 's/rc//g' | sed 's/^ *//;s/ *$//' \
| sed 's/ \+ /\t/g' | cut -f 1`


Remove all GNOME from debian - a one line command

This one is not so easy to follow, but it works for me :-).

Do try only the stuff inside `` (back tick operator in the bash language), to see what it does:

$ aptitude remove `dpkg -l | grep gnome | sed 's/ii//g' \
| sed 's/rc//g' | sed 's/^ *//;s/ *$//' \
| sed 's/ \+ /\t/g' | cut -f 1`


GNOME Fork is dead ...

The EXDE project, which aimed to continue supporting gnome 2.X is dead. This is really a shame,
I wish I could have taken part in it. I really like the user experience that GNOME 2.X offered new comers to Linux, and it was always my default recommendation when I installed a new laptop with Linux to a friend.

I will keep looking for an alternative for GNOME 2.X, and I already expect to start working with XFCE 4.8 on my installed Debian.




Thursday, March 31, 2011

running more than one linux distribution without rebooting ...

My laptop has reached Nirvana with Debian Squeeze, everything works out of the box, and I very happy with the stability of the system. I don't feel the software is outdated, because I anyway install some applications I need or like directly from source.
However, I still want to be able to run Debian testing, and see how my system evolves. Enter "chroot".

With chroot I can run more that one Linux Distro and more than one X-Server with out the need to stop my work and reboot my laptop. This is just great.

Here is how to do it, assuming you already have a partition with a Debian installed on in do the following (if you don't have a partition with Debian installed, I suggest you take a look at "debootstrap"):

1. First make a location where you will work as the root of the new debian, in my case:
$ su -
# mkdir /debian-sec
2. now mount that partition, in my case /dev/sda5:
mount /dev/sda5 /debian-sec
3. enable important devices so the new Debian will work as expected.
mount -o bind /proc /debian-sec/proc
mount -o bind /dev/ /debian-sec/dev/ 
mount /dev/pts /debian-sec/dev/pts -t devpts 
mount -t sysfs /sysfs/ /debian-sec/sys 
4. finally change the root with chroot:
chroot /debian-sec/ /bin/bash
If you want to run a secondary X-Server, do the following inside the chroot:
chroot # vi /etc/gdm/gdm.conf # do s/vt7/vt9/ in [servers] section
chroot # /etc/init.d/gdm start
this will start another X-Server on vt9, to which you can switch with Alt+Ctrl+F9.

Cheerios, Linux and Debian !

UPDATE: The last section about GDM in chroot seems not to work in gdm3...
with gdm3:

chroot # vim /usr/share/gdm/gdm.schemas

change the following keys:
   <schema>
      <key>daemon/FirstVT</key>
      <signature>i</signature>
      <default>9</default>
    </schema>



What does work ?

Switch to tty1, login as root, and chroot into the chrooted debian.
Then chanage to with "su - "

now start the X server as the following:
startx /usr/bin/fluxbox -- :1&
or
startx /usr/bin/gnome-session -- :1&
or
startx  -- :1&


Friday, March 25, 2011

'yes,yes' we can ... on the usefull linux command ...

Recently I started building my own LFS, I was pretty amused by the command 'yes'...

However, today I found a use for that command, when I had to install a binary firmware on multiple servers. The binary is not editable and  expects two times 'yes' to finish the process.
So, the solution is to run on all the computers the following command inside a loop :
'yes | sh binary_firmware.exe' - also, this is a simple example a of parallel programming and pipes.

This little trick saved me quite some typing and waiting in front of the computer !


Thursday, March 03, 2011

Matlab Alternative: RStudio

To the list of great Matlab alternative I add today RSTUDIO.
Although, I usually don't program in R, I am glad to see it is not freezing, and continuously develop as a scientific interested language. I am guessing that this fancy IDE for R, would make it easier to accept among people who are deeply rooted in the EXCELLENT MATLAB IDE.
However, doing most of my scientific tasks, and system administration in python, I think Matlab's syntax is equally weird to that of R ;-).

One weird choice of the developers is to call the binary rdesktop instead of rstudio... Maybe they don't know about rdesktop
which is familiar to most system administrators ... oh, well, I guess I'll have to open a bug ...

Saturday, February 26, 2011

Network-manager still sucks !

I have been long complaining about the buggy network-manager included in GNOME. Today, I have (re)discovered I am still unable to use Network-Manager to connect to a WPA secured wirless...
Being too lazy to look up why on a clean install of Debian Mint Linux Edition, Network-Manager is still retarded, I opted to the following solution:

apt-get --purge remove network-manager && apt-get install wicd wicd-gtk

So long, Network-Manager!

Friday, February 25, 2011

oh, Yesterday I was a bad programmer ...

Forgetting my first lesson in programming, I looked for a solution to convert IP addresses to country. I found out tables, and SQL files, and went on and on trying to figure how to use them, and do SQL in python...
Until, I remembered that a good programmer should not re-invent what has been invented.
And then I looked around and found: pygeoip.
I honestly felt sorry for the time I wasted on that problem ...

Friday, February 18, 2011

Hey, I actually like the new Blogger

It used to really suck, but my two hours of playing with it made me change my feeling about it.
I have almost as much control as I have with my own WordrPress instance! This is AWESOME ! And I can even link it to my google adsense very easily.
Thanks Google for making a great job !
Wow, Long time ago ... My last post ages ago was a rant about Uhbuntu ...
Needless to say that since then, I have quit using Uhbunutu as my main Desktop, and moved to Debian and ArchLinux. I also play extensively with OpenBSD and FreeBSD, and at work my workstation is OpenSUSE from which I maintain mostly CentOS servers. But no Uhbuntu ...