How to make animated GIF with GIMP.

 l!nux  Comments Off on How to make animated GIF with GIMP.
May 202014
 

Launch GIMP. If you don’t have it – download it from their site. It is free and multiplatform (works like a charm in both Windows and Linux environment).

Step 1. Decide what size your GIF animation will be. Then go to “File -> New” and enter your desired size as Width and Height.

Choose GIF size.

Choose GIF size.

Step 2. Decide how many frames should your GIF animation be, then go to Layers window and duplicate the “Background” layer as many times as the frame count you choose.

Duplicate background Layer.

Duplicate background Layer.

Step 3. Hide the ones, that are not currently needed by clicking on the “eye icon” beside the layer, choose the one on the bottom and name it “Frame 1” (Click on the layer and press “F2” to change name)

Select frame, disable the visibility of the others.

Select frame, disable the visibility of the others.

Step 4. Draw your frame or paste the prepared picture on the white space and then merge it on the layer. Repeat for all frames.

Step 5. Go to “Filters -> Animation -> Playback” and have a look at what you’ve done so far as a sequence. Edit or fix frames if you don’t like the smoothness. Tweak until satisfied.

Step 6. Add the delay of each frame in milliseconds by editing frame name, like in step 3. 1000 milliseconds equals 1 second. Use Playback again as in the previous step, until the timing suits you.

Add desirable timing for each frame.

Add desirable timing for each frame.

Step 7. Use “File -> Export” choose file name and use “.gif” as extension. Choose file type from the drop-down menu below to “GIF” as well. Be sure to check the checkbox for “Animation” and “Loop indefinitely” if you want it to cycle indefinitely.

Check those 2 checkboxes.

Check those 2 checkboxes.

Step 8. You are quite done. Open your newly created file with any browser capable of showing GIF animations.

Completed GIF animation.

Completed GIF animation.

 Posted by at 4:31 pm
Jul 202011
 
How to find all executable files:


find / -type f -perm -o+rx

This can take quite a while, so you may want to pipe the results to less so you can search in them or instead of root directory to use /bin or /usr/bin.

How to automount USB memory stick devices with user rights.

Edit the line in /etc/group saying “plugdev” with your user name:

plugdev:x:83:root,yourusername

This way every time there is new USB device plugged in the system, you will see a new Icon on your desktop with its name and size. You need to restart udev as root by writing:

sudo /etc/rc.d/rc.udev reload
sudo /etc/rc.d/rc.udev restart

How to change DOS/Windows CR+LF to Unix (dos2unix)

If you don’t have this utility, use the following:

perl -pi -e 's/\r\n/\n/;' DosFilename.txt

How to strip configuration lines from the prompt

Imagine you have a switch configuration example like this:

DUT(config)#system monitor
DUT(config-monitor)#cpu-temperature
DUT(config-cpu-temperature)#log
DUT(config-cpu-temperature)#trap
DUT(config-cpu-temperature)#low-threshold 10
DUT(config-cpu-temperature)#no shutdown
DUT(config)#log ssh-console severity debug
DUT(config)#commit

You need only the configuration lines, without the prompts, so you easily copy&paste them later, when you need to set the switch. Executing this command and pasting results *(or piping them) will strip everything in left of the pound sign (including the sign):

cat | awk -F"#" '{ print $2 }'
or:
cat copied_manual.txt | awk -F"#" '{ print $2 }'

How to decode text to ascii codes for SNMP

Sometimes, walking an SNMP table may show you the following lines:


dot1agCfmMdRowStatus.7.100.111.109.97.105.110.53

This OID line is quite straight forward until the digits. Dot1ag means the standard 802.1ag (OAM CFM) and the status of the maintenance domain. For some reason the remaining text is in ASCII + char length. 7 is char length and the remaining ASCII codes mean “domain5”. I wrote some Perl script to convert strings to dot-digit format for this:

#!/usr/bin/perl -w

if (! $ARGV[0]) {die "There are no args";}

print $ARGV[0];
print " is equal to ";
@ascii_character_numbers = unpack("C*", $ARGV[0]);

print scalar(@ascii_character_numbers);

foreach (@ascii_character_numbers) {
    print ".";
    print $_;
}

print "\n";

Usage is:

unascii.pl testtest
testtest is equal to 8.116.101.115.116.116.101.115.116

Check the next tricks article too 😉

 Posted by at 10:03 am
Jul 152011
 

Slackware Linux uses udev to decide how to manage the recognized devices in your /dev/ directory. Also any hotplug devices are also handled by udev for loading the appropriate kernel modules and create(or enable) a /dev node for mounting purposes. Udev is doing quite well, except in 2 cases:

  • You need eth1 to actually be eth0 and eth2 to become eth1.

This is one of the cases, in which you have e.g. 1GBps NIC and want it to be exactly eth0 and 2 more that you need for your home network set. You already have the scripts to create NAT and they point to eth0 by default. It’s faster to switch NIC names than to rewrite the scripts.

  • Your motherboard died and you want your hard drive moved to another system so you keep working.

In this case, most if not all the new motherboard components will be recognized by udev but there will be one difference in one specific file at /etc/udev/rules.d/ this file is called 70-persistent-net.rules and is responsible for mapping the network cards by their manufacturing address (MAC address).

The file looks like this:

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:40:95:30:c5:7e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:06:4f:29:49:f0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:6c:e2:ff:d2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

And if you want the NICs remaped, the only thing that needs to be done is to set the option NAME in the end of each line to whatever you want your NICs to be set. This is about the first scenario.

The second scenario, when you place the hard drive to a new system with similar configuration, you will see the udev will actually displace the NICs. If your old system had eth0, eth1 and eth2 – now your system will have eth3, eth4 and eth5. Old/original NICs places will be kept (as if your broken machine will revive 😉 hahaha 😀 )

You need to set them back to point to eth0, eth1 and eth2 and no system reconfiguration will be needed (except in the case where your Video card is different, than you need to reconfigure X.org).

That’s basicly it. Modify /etc/udev/rules.d/70-persistent-net.rules and restart the udev process.

bash-4.1# /etc/rc.d/rc.udev restart

The next step is to make your configuration go back to what it was. It’s actually one command only if you have not changed anything else:

bash-4.1# /etc/rc.d/rc.inet1 restart

That way, your network should be back to what it was.

 Posted by at 6:00 pm