Πέμπτη 28 Αυγούστου 2008

Bash tips I love

Ένα φανταστικό tip που έμαθα χθες στην δουλειά (thanks to Γιώργος Οικονόμου):

!&


pwd
/root/Desktop
mkdir /home/ventrix/tmp/hello/
cd !&

pwd
/home/ventrix/tmp/hello/



το !& ουσιαστικά "αντιπροσωπεύει" όλες τις παραμέτρους της αμέσως προηγούμενης εντολής.

!!


echo hello
hello
!!
hello


Το !! αναλαμβάνει να εκτελέσει ξανά την αμέσως προηγούμενη εντολή.

![αριθμός]


history
...
515 mkdir /home/ventrix/tmp/hello/
516 echo 1 2 3
...
!516
1 2 3


Το history μας επιστρέφει τις τελευταίες εντολές του τερματικού. Γράφοντας ! και τον αριθμό της εντολής αυτή θα ξανατρέξει.

Και για το τέλος άφησα το αγαπημένο μου:
![γράμματα]


history
...
515 mkdir /home/ventrix/tmp/hello/
516 ssh test@test.org
517 echo 1 2 3
...
!ssh (ή !s ή !ss δουλεύουν εξίσου στην συγκεκριμένη περίπτωση)
ssh test@test.org


Χωρίς να χρειάζεται να κάνουμε history γράφοντας ! και τα πρώτα γράμματα τις εντολής εκτελείται η αμέσως προηγούμενη εντολή που ξεκινάει με αυτά τα γράμματα!

Προσοχή με την χρήση αυτής της εντολής, είναι πολύ επιρρεπής στο λάθος!

Τετάρτη 13 Αυγούστου 2008

Μηνύματα λαθών. Μπορούν να κάνουν την διαφορά!

Post μου απο το forum του Hellug:

Μετά απο αρκετή παρατήρηση νομίζω οτι το κυριότερο πρόβλημα κατα την μετάβαση απο windows σε linux είναι οτι ποτέ οι νέοι χρήστες δεν διαβάζουν το μήνυμα λάθους, ούτε τους δίνουν ιδιαίτερη σημασία.

Πρέπει να παραδεχτούμε βέβαια οτι δεν ευθύνονται οι ίδιοι για αυτό, αφού αυτό είναι μια συνήθεια που προήλθε απο το προηγούμενο λειτουργικό σύστημα που χρησιμοποιούσαν και τα μηνύματα λάθους φάνταζαν γλώσσα εξωγήινων, ικανή να καταλάβουν μόνο hi-tech freaks και αν.



Δύο γεγονότα αποδεικνύουν την παραπάνω θεωρία. Πρώτα είναι η "θεαματική" αλλαγή που έγινε στα XP όπου το λάθος παρέμενε το ίδιο ακατανόητο, όμως η microsoft μας ζητούσε ταπεινά συγνώμη για το γεγονός (κοιτάξτε ξανά την παραπάνω εικόνα!). Δεύτερων, είναι η ύπαρξη προγραμμάτων και ιστοσελίδων οπου τα "λάθη" μεταφράζονταν σε κάτι πιο κατανοητό.

Αυτή η αναίτια απόκρυψη των λαθών (Θέλεις να το πείς και: "Δεν θέλω να φρικάρω τον χρήστη;") ώστε να δείς τι δεν δουλεύει σωστά και να προσπαθήσεις να το λύσεις, δημιούργησε μια τάση "πατάω το ΟΚ όσο πιο γρήγορα γίνεται και παραπονιέμαι στον αέρα/ξάδερφο/μαγαζάτορα".

Χαίρομαι που τα μηνύματα λαθών στο linux είναι πάντα (εξευτελιστικά σε μερικές ιδιαίτερες περιπτώσεις) λεπτομερή...

Τρίτη 5 Αυγούστου 2008

X11 fordwarding from linux to windows

If you are working under linux with a X server and want to use an X application that runs at another linux machine you should just

ssh -Y user@server

and start the application. The application will run on the "server" machine, but it will be displayed on your screen.

If you are running windows and want to use an X application that runs on your linux machine just use Xming from http://www.straightrunning.com/XmingNotes/ .

A Greek guide can be found here: http://ebalaskas.gr/wk/putty

Παρασκευή 1 Αυγούστου 2008

Color at the bash shell

This page have some great tips on how to add color to your bash shell.

Excellent!

http://www.funtoo.org/en/articles/linux/tips/prompt/

Πέμπτη 31 Ιουλίου 2008

How foxmarks saved me...

I use firefox a lot. I have it installed at all the computers I use.
My main PC at home, my secondary pc at home, my laptop, my asus eee, my work's PC, all of them have firefox.
Moreover I use several operating systems at these PC's. So I use 7 different firefox installations.

I always had trouble keeping my bookmarks organized. My first solution was to build a simple php script that using a mysql database was able to save my favorite bookmarks. But it was a little trouble. Whenever I wanted to add a bookmark I had to visit the php script, enter the password, write down the url, click the "Submit" button and get a "Bookmark was added" confirmation message.

It was actually a very good idea. I also added a nice wysiwyg editor, a comment system and start using it in different ways.

So I concluded with a note/blog/bookmark/todo/remember system. It was fast, simple and I had access from anywhere.

That worked just fine until I found foxmarks. Foxmarks is a plugin for firefox that synchronizes the bookmarks. Also it has a useful web interface to check your bookmarks online without downloading the plugin.

Now I do not care at what pc I'm working on, I know that my bookmarks will be there synchronized.

Thank you foxmarks!

http://www.foxmarks.com/

Τετάρτη 30 Ιουλίου 2008

dsniff package: Various tools to sniff network traffic

Let me introduce you one of my favorite networking tools: dsniff

dsniff:
Various tools to sniff network traffic for cleartext insecurities
This package contains several tools to listen to and create network traffic:

* arpspoof - Send out unrequested (and possibly forged) arp replies.
* dnsspoof - forge replies to arbitrary DNS address / pointer queries on the Local Area Network.
* dsniff - password sniffer for several protocols.
* filesnarf - saves selected files sniffed from NFS traffic.
* macof - flood the local network with random MAC addresses.
* mailsnarf - sniffs mail on the LAN and stores it in mbox format.
* msgsnarf - record selected messages from different Instant Messengers.
* sshmitm - SSH monkey-in-the-middle. proxies and sniffs SSH traffic.
* sshow - SSH traffic analyser.
* tcpkill - kills specified in-progress TCP connections.
* tcpnice - slow down specified TCP connections via "active" traffic shaping.
* urlsnarf - output selected URLs sniffed from HTTP traffic in CLF.
* webmitm - HTTP / HTTPS monkey-in-the-middle. transparently proxies.
* webspy - sends URLs sniffed from a client to your local browser

Τρίτη 29 Ιουλίου 2008

Cool transparent xfce4-terminal without borders

alltray "xfce4-terminal --geometry=123x26+240+160 --hide-menubar --hide-borders --hide-toolbars"

Δευτέρα 28 Ιουλίου 2008

Linux mass photo resize

Resizing photos in Linux it's just a simple command.

First you have to have the Imagemagick package installed.

Then create a copy of the folder of the photos you want to resize.

Go to that directory and enter:

mogrify -resize 640x480 *.*



REMEMBER that the photos will be resized so if you want to keep the original photos you HAVE to keep a backup of your photos first.

Πέμπτη 24 Ιουλίου 2008

Check PHP script's execution time

An easy way to see how long it takes PHP to run a script:

1) Put this at the top of the page inside the php brackets


$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;



2) Put other code and html


3) Put this code at the bottom of the page


$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds";




http://www.developerfusion.co.uk/show/2058/

Δευτέρα 21 Ιουλίου 2008

Lazy Linux: 10 essential tricks for admins from IBM

Lazy Linux: 10 essential tricks for admins from IBM

http://www.ibm.com/developerworks/linux/library/l-10sysadtips/index.html?ca=drs-

Very very nice...

Check this out too: http://www.ibm.com/developerworks/views/linux/libraryview.jsp?topic_by=All+topics+and+related+products&sort_order=desc&lcl_sort_order=desc&search_by=&search_flag=&type_by=Tutorials&show_abstract=true&sort_by=Date&end_no=100&show_all=false&S_TACT=105AGX03&S_CMP=ART

Τετάρτη 16 Ιουλίου 2008

Linux without sound??? NO WAY!

So you installed linux but you are not able of listening your favorite artists?

DO:

sudo aptitude install alsa-base alsa-utils alsamixergui linux-sound-base



After you install them try:

sudo alsaconf



This will search for a playback device and install it automatically.

Run alsamixergui and make sure nothing is muted, your speakers are on, connected to your pc, volumed up and working (!)

Install your favorite player (mplayer, vlc, xmms) or my favorite player (amarok) and enjoy!

PHP and RSS

PHP and RSS

Μια μαγική βιβλιοθήκη που απλά τα έκανε όλα πολύ εύκολα (και γρήγορα!)

http://magpierss.sourceforge.net

Τρίτη 15 Ιουλίου 2008

My desktop's screenshot

It's Debian 2.6 with XFCE I use @ work. Really beautiful.


Just love the beauty of simplicity.

Here's a link to ten other nice desktops: http://liakoni.gr/node/48

And a second try:

Δευτέρα 14 Ιουλίου 2008

How to change mac address

Changing mac address in one interface at linux is extremely simple.

All you have to do is:

ifconfig ath0 hw ether ne::w::mac::addr::e::ss::


Using this method will change your mac address temporary only, until the next reboot.

Alternatively you can install the macchanger package which has the following features:

* set specific MAC address of a network interface
* set the MAC randomly
* set a MAC of another vendor
* set another MAC of the same vendor
* set a MAC of the same kind (eg: wireless card)
* display a vendor MAC list (today, 6200 items) to choose from

It also has a nice gui: macchanger-gtk

Κυριακή 13 Ιουλίου 2008

Change volume with command

Change volume with command

amixer -q set PCM 2- unmute

amixer -q set PCM 2+ unmute



also try: alsamixer and alsamixergui