Pages

Monday, January 31, 2011

git hooks

git comes by default with a number of hooks. Hooks are little scripts you can place in $GIT_DIR/hooks directory to trigger action at certain points. When git init is run, a handful of example hooks are copied into the hooks directory of the new repository, but by default they are all disabled.
It's good to know that each hook that has execution rights, will indeed get executed. If you have an executable hook by mistake you can end up with this error:

lvarga@lvarga-desktop:~$ git push origin master
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 455 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
*** Project description file hasn't been set
error: hooks/update exited with error code 1
error: hook declined to update refs/heads/master
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'ssh://gitserver/var/www/git/repo.git'

This happened after I changed the permissions of the hooks. I was only using the post-receive hook, all the others were default. I gave all of them execution rights and then I had quite a hard time understanding why some empty hooks were executed.
Then googled a bit and found that the permissions are the problem. It went away after I took out the execution right of all the hooks I didn't use

Thursday, January 27, 2011

late is good - how statistics can be deceiving

I read today an article which said that we (Romania) have the fastest internet connection in Europe. Of course this article was in a Romanian online newspaper. For the article see this. The I made some research to see if this is true and what are the explanations of Romania ranking first in this top, I have to admit it rarely does when being first is something positive.
First of all I searched some international tops. Romania was in the 4th place in the world and 3rd in Europe. Not the first, but good enough anyway. South Korea is the first, then Lithuania and Latvia. For the entire top, check this out. Seeing these countries in the top made me search further.
Then I found the reason, the explanation behind these figures: internet connections became available in Romania later then in more developed countries. This meant that the technology first used was newer and better. Until now it all sounds good: we are faster, newer, better. And then: there is another sexy thing called internet penetration rate. This show which is the percent of a country's population that has internet access. I found a top listing the first 58 countries in the world here, but Romania is not present in this top.
So, all in all, we have something, that's true. We have broadband internet connections, modern equipment. But still we are behind. We are behind because our infrastructure is covering only around 30% of our country. This is just an example how figures and statics can be somehow deceiving, how you should look further into an issue before having an opinion, before being proud or sad or whatever. Information is out there, just grab it!

Tuesday, January 25, 2011

linux restricted user

I was using scponly for creating restricted users, but I found that setup quite complicated to use, so I was searching for an alternative. I found rssh, which was much simpler:

[root@zion ~]# yum install rssh 
[root@zion ~]# adduser -g rsshusers myuser

Edit /etc/passwd:

myuser:x:513:109::/home/myuser:/usr/bin/rssh

For configuring rssh, see /etc/rssh.conf. You can:


allowscp
#allowsftp
#allowcvs
#allowrdist
#allowrsync

Also, you can configure chroot for the restricted user if you want. So, it's quite simple to setup, simple to use.

Thursday, January 20, 2011

gone bad

I was reading the other day one interesting article. It was about a sysadmin that went bad, really bad: he was working for a quite large online retail company, but he also had a small company of his own. He used his small company to sell his employer pirated software for an amount of several hundred thousands dollars.
When BSA checked the company, they had a big surprise. This made them call some consultants, because they feared to confront their sysadmin. He had all the passwords, he had control over their hole infrastructure and they were afraid of him holding it as a hostage. The consultants also discovered that the company servers were hosting a medium-sized porn site. And, there is more: the sysadmin had a list of credit card details of several hundred of the retailer's client.
Of course this is a situation. After the consultants analysed and assessed the situation, their plan was the following: they came up with a reason to send the sysadmin to the other coast. This way, they assured that they had a window of opportunity to reset all the passwords during the sysadmin's flight. After they did this the bad guy got fired, of course.
Happy ending. But is it? How long is to long to have such a person working for you and not noticing that something is wrong? How long is it ok for an online reseller to host a porn site? And many other questions like this..
I always like to consider the worst case scenario when I make an assessment and take a decision. I wouldn't want to have a fight with my sysadmin. I would keep him happy and if necessary make a clean break-up and remain friends. It's not a good idea to have a fight with your car's mechanic. Maybe you find yourself without brakes or a wheels fells off.
Anyway, I really don't agree with the things this man did. It's just not right. But we all have to realise what are the possibilities, what could happen. This is a funny story to tell. But I bet no one would feel that good in the retailer's shoes.
And I continued reading about this kind of stories. I feel that there is a simple cause for all these kind of incidents: management fails to see people. They only see and manage resources. You can handle resources quite easy. There are no feeling, resources don't get angry and don't want revenge. Equations seem simple: you want the best security, you buy the best product. Well, if you don't see the people, you might get hurt, no matter how much you pay for your security products.

Saturday, January 8, 2011

Ubuntu can be negative!


Negative
The Negative plugin provides immediate, high-contrast windows for the visually impaired by inverting the colors of individual windows, or all windows at once.

    * To enable or disable Negative on the focused window, press Super+n.
    * To enable or disable Negative on the screen, press Super+m.


Of course this happened by mistake and I had to search for a way to revert it. Great things come out of mistakes.

Thursday, January 6, 2011

(do) things own us (?)

I remember when I was a bit younger. Money was not all that important for me. I mean, ok, if I had any I would be happy, spend then, end of story. If I didn't have the money, it was not such a big deal.
These days I caught myself thinking what would happen if I had no more money and at first I thought it's something really bad. Then I started comparing my situation now with my own situation a while ago, when I didn't care about this. What is the difference? I guess back then I had nothing to lose. I had nothing of my own. I was living with my parents, loaning their car when I needed one, eating from the fridge and so on. This is a pretty happy and careless life, I guess everybody could agree.
And now.. now it seems that I have more: a car of my own, a place to live, a fridge which occasionally becomes empty if there is no refill. Anyway, you know, everything from the movies: "Choose life. Choose a job. Choose a career. Choose a family. Choose a fucking big television, Choose washing machines, cars, compact disc players".
Ok, so I have all these but now I worry that maybe someday I would not have enough money. Enough money for what?
After careful deliberation the verdict is the following: I would not have money to buy gas for the car, to repair it, to fill the fridge, to pay for electricity for that TV and so on. All the things I own get back to me. It's like a revenge of the undead, the revenge of the things I own against myself. I started to think that actually these things own me, not the other way around. They don't have to go to work every day to earn money for me, instead I end up waking up each morning.
The solution to this problem was presented in a movie some time ago. If you blow everything up, then the problem is gone. Then you can start your own secret club where people meet to beat each other up. And you get to make up stupid rules like: "The first rule of Fight Club is: you do not talk about Fight Club".

Tuesday, January 4, 2011

Life/Tech

I sometimes wonder where technology ends and life starts. But this is a question that you could ask some time ago. I don't think that we still have a line between technology and our daily life. Maybe we have but it moves constantly and there is less and less of anything that has no connections or interactions with technology.

I am trying to lose some weight so I went on the android market and searched for some software that helps me do that (as if any software could do that.. yes, I know). I found there some pretty neat applications: one that graphs your weight over time (Weigh Weight LITE  ). Another one that uses the phone's gps, google maps and your selection of the activity to draw your track, compute the consumed calories and of course upload these on the web. Maybe even on facebook, so you can share these statistics and results with your friends. The second application is called  runtastic  This application can also do geotagging using the photos you make while working out. Of course I also found a WI-FI body scale that also uploads infos on the web. And of course this could go on and on.

 I have the feeling that the thing we call web is spreading very fast and it takes control of everything we do. And it's quite difficult to keep your perpective in the process. Ah.. I forgot to mention about the fridge which has a linux OS. This first came as a joke here but who can tell where the joke ends and reality will take place? 

My point was to show how our life is getting more and more connected each day. There will be a day when we will see facebook as a necessity. History and evolution is very interesting. I can only wonder when I remember that I first used ms dos and now I am in the middle of all this tech frenzy.

Monday, January 3, 2011

puppet addon for vim

There is an addon to puppet which enalbes syntax highlighting of the *.pp files. To install this addon on ubuntu:
sudo apt-get install vim-puppet
The addon is installed, but you still need to enable it. For this you use the vim addon manager:
vim-addons install puppet