zeldor.biz

Linux, programming and more

Copyright © 2025
Log in

Create Nagios Icons

December 2, 2010 by Igor Drobot Leave a Comment

Nagios

If you ever tried to make Nagios Status-Map a little nicer by adding some dependencies and some pretty icons, you have probably came across some little collections/packs of icons at NagiosExchange.
But if you need a special one, you must do it by yourself.
And you probably noticed that you need images with .gd2 extension
Here is how to convert a PNG image into .gd2 (GD Graphics Library format)

Solution one:

1
aptitude install netpbm

aptitude install netpbm

1
pngtopnm example.png | pnmtopng -transparent =rgb:00/00/00 2>/dev/null | pngtogd2 /proc/self/fd/0 example.gd2 0 1

pngtopnm example.png | pnmtopng -transparent =rgb:00/00/00 2>/dev/null | pngtogd2 /proc/self/fd/0 example.gd2 0 1

Solution two:

1
aptitude install libgd-tools

aptitude install libgd-tools

1
pngtogd2 phone.png phone.gd2 0

pngtogd2 phone.png phone.gd2 0

Filed Under: Bash, Linux, Monitoring Tagged With: Monitoring, Nagios, Nagios convert gd2, Nagios3

Understanding FTP using commands

November 29, 2010 by Igor Drobot Leave a Comment

FTP and SMTP are simple text based protocols, I show you how to get some files without a graphical FTP-Client.

Connect with Telnet:

1
2
3
4
5
6
id@acer:~$ telnet debianuser.org 21
Connected to debianuser.org.
USER anonymous
PASS anonymous
PASV
RETR deli-0.8.0-core.iso

id@acer:~$ telnet debianuser.org 21 Connected to debianuser.org. USER anonymous PASS anonymous PASV RETR deli-0.8.0-core.iso

[Read more…]

Filed Under: Bash, FTP, Linux Tagged With: command line ftp, FTP

Make your linux speaking

November 28, 2010 by Igor Drobot Leave a Comment

Speaker

1
echo 'you are a loser' | festival --tts

echo 'you are a loser' | festival --tts

1
for count in $(seq 1 10) ; do espeak "Go Away" ; done

for count in $(seq 1 10) ; do espeak "Go Away" ; done

Make speaker louder:

1
2
3
4
amixer -c 0 sset Master,0 100%;
amixer set Master 100%
# or
amixer set PCM 100%

amixer -c 0 sset Master,0 100%; amixer set Master 100% # or amixer set PCM 100%

Another funny things:

1
2
export DISPLAY=:0
xmessage 'YOU ARE BEING WATCHED. MUHAHAHAHahaha'

export DISPLAY=:0 xmessage 'YOU ARE BEING WATCHED. MUHAHAHAHahaha'

Filed Under: Bash, Fun, Linux Tagged With: alsamixer, espeak, Fun

Dropbox KDE integration

November 28, 2010 by Igor Drobot Leave a Comment

After working some time with Dropbox I wrote this little python script to make my work with Dropbox more efficient and faster.

With a right click I can Upload my file to my Dropbox account:

Right Click

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python
# -*- coding:utf-8 -*-
 
import os, sys
 
PUBDIR = '/home/id/Dropbox/Public/'
USERID = 156881168
 
if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]):
 os.popen('cp -f %s %s' % (sys.argv[1], PUBDIR))
 dest = 'https://dl.getdropbox.com/u/%s/%s' % (USERID, sys.argv[1].split('/')[-1])
 os.popen('kdialog --msgbox "Link was copied to the clipboard:\n%s"' % dest)
 os.system('dbus-send --print-reply --dest=org.kde.klipper \
    /klipper org.kde.klipper.klipper.setClipboardContents string:"%s"' % dest)
else:
 os.popen('kdialog --error "Please choose file!"')

#!/usr/bin/env python # -*- coding:utf-8 -*- import os, sys PUBDIR = '/home/id/Dropbox/Public/' USERID = 156881168 if len(sys.argv) > 1 and os.path.isfile(sys.argv[1]): os.popen('cp -f %s %s' % (sys.argv[1], PUBDIR)) dest = 'https://dl.getdropbox.com/u/%s/%s' % (USERID, sys.argv[1].split('/')[-1]) os.popen('kdialog --msgbox "Link was copied to the clipboard:\n%s"' % dest) os.system('dbus-send --print-reply --dest=org.kde.klipper \ /klipper org.kde.klipper.klipper.setClipboardContents string:"%s"' % dest) else: os.popen('kdialog --error "Please choose file!"')

Add a menu entry for right click:

1
2
3
4
5
6
7
8
9
10
11
12
13
vim /usr/share/kde4/services/ServiceMenus/dropbox.desktop
cat /usr/share/kde4/services/ServiceMenus/dropbox.desktop
 
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin,all/allfiles
Actions=DropboxURL
X-KDE-Priority=TopLevel
 
[Desktop Action DropboxURL]
Name=Share on DropBox
Icon=/home/id/Pictures/dropbox.png
Exec=/home/id/drop_IT.py "%u" %d

vim /usr/share/kde4/services/ServiceMenus/dropbox.desktop cat /usr/share/kde4/services/ServiceMenus/dropbox.desktop [Desktop Entry] Type=Service ServiceTypes=KonqPopupMenu/Plugin,all/allfiles Actions=DropboxURL X-KDE-Priority=TopLevel [Desktop Action DropboxURL] Name=Share on DropBox Icon=/home/id/Pictures/dropbox.png Exec=/home/id/drop_IT.py "%u" %d

Update:
If you want to make it work only for special users on the system, put dropbox.desktop in your home directory: “~/.kde/share/kde4/services/ServiceMenus”

Another bash based script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
 
DROPDIR=/home/id/Dropbox/Public/
USERID=156881168
 
if [ -e "$1" ]
then
        cp -f "$1" "$DROPDIR"
        file=`basename "$1"`
        link="http://dl.getdropbox.com/u/$USERID/$file"
        notify-send -i go-down "Dropbox" "Link to \"$file\" was copied to the clipboard"
        echo "$link" | xsel -bi
else
        notify-send -i go-down "Dropbox" "Please choose file!!"
fi

#!/bin/bash DROPDIR=/home/id/Dropbox/Public/ USERID=156881168 if [ -e "$1" ] then cp -f "$1" "$DROPDIR" file=`basename "$1"` link="http://dl.getdropbox.com/u/$USERID/$file" notify-send -i go-down "Dropbox" "Link to \"$file\" was copied to the clipboard" echo "$link" | xsel -bi else notify-send -i go-down "Dropbox" "Please choose file!!" fi

Icon — Could be a pretty icon (16×16) Icon Dropbox Upload
Exec — path to you *.py script

Filed Under: Bash, Linux

Upgrade Debian lenny to squeeze

November 20, 2010 by Igor Drobot 1 Comment

Debian Logo

This upgrade from lenny to squeeze is not more complexer then the update from etch to lenny.
If you read everything carefully your server will run after upgrade too:)

Before you go on please read the official Debian release notes:

Recording your session:

1
script -t 2>~/upgrade-squeezestep.time -a ~/upgrade-squeezestep.script

script -t 2>~/upgrade-squeezestep.time -a ~/upgrade-squeezestep.script

First you should update your running system:

1
aptitude update && aptitude dist-upgrade

aptitude update && aptitude dist-upgrade

Check the package state:

1
dpkg --audit

dpkg --audit

It will show any packages which have a status of Half-Installed or Failed-Config, and those with any error status.

If you had a kernel upgrade please reboot. After successfully updates replace the sources from lenny to squeeze:
[Read more…]

Filed Under: Bash, Debian, Kernel, Linux Tagged With: Debian squeeze, lenny to squeeze, Upgrade debian

  • « Previous Page
  • 1
  • …
  • 7
  • 8
  • 9
  • 10
  • 11
  • Next Page »
Yeaaah Cookie! We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok