Here’s a oneliner bash script that uses wget, sed, awk, and tr to download a video from YouTube.

Tested on Debian and Mac. Just put the code below in a file and make your file executable using:

chmod +x yourfile.sh

#!/bin/bash

## Two arguments
# $1 Youtube URL
# $2 You name for the video
wget -c –no-check-certificate –user-agent=”" $1 -qO- | \
sed ‘s/\\u0026/\&/g’| \
awk ‘/fmt_url_map/{gsub(/[\|\"]/,”\n”);print}’ | \
sed -n “/^fmt_url_map/,/videoplayback/p” | \
sed -e :a -e ‘$q;N;2,$D;ba’ | tr -d ‘\n’ | \
sed -e “s/\(.*\),\(.\)\{1,3\}/\1/;s/\\\//g” | \
wget -c –no-check-certificate –user-agent=”" -i – -O $2.flv

After putting in a file and making it executable just go get your YouTube url and fire off the download.
Here’s an example.

./youtube_downloader.sh ‘http://www.youtube.com/watch?v=FRWLfY7hMgQ’ filename_to_save

This will make the file filename_to_save.flv in your dir.

Enjoy.

inadyn is a C based client used to update DNS entries. Inadyn is an IP update client for DynDNS.com, no-ip.com , etc.

Why we need this? Well you don’t really need this if you are using static IP.

But if you have dynamic IP, you must keep your IP updated with the domain you choose in DynDNS.com or no-ip.com  every time you restart the router. Otherwise, the visitors can’t reach to your server.

Installation:

apt-get update && apt-get install inadyn

or you can download inadyn:

cd /usr/src

wget http://cdn.dyndns.com/inadyn.zip

unzip inadyn.zip

cp inadyn/bin/linux/inadyn /usr/bin/inadyn

Change the file permission:

chmod 755 /usr/bin/inadyn

Configuration file for inadyn:

Continue Reading…

What is ebtables? (Ethernet bridge frame table administration)

The ebtables utility enables basic Ethernet frame filtering on a Linux bridge, logging, MAC NAT and brouting. It only provides basic IP filtering, the full-fledged IP filtering on a Linux bridge is done with iptables. The so-called bridge-nf code makes iptables see the bridged IP packets and enables transparent IP NAT. The firewalling tools iptables and ebtables can be used together and are complementary. ebtables tries to provide the bridge firewalling that iptables cannot provide, namely the filtering of non-IP traffic.

What can ebtables do?

  • Ethernet protocol filtering.
  • MAC address filtering.
  • Simple IP header filtering.
  • ARP header filtering.
  • 802.1Q VLAN filtering.
  • In/Out interface filtering (logical and physical device).
  • MAC address nat.
  • Logging.
  • Frame counters.
  • Ability to add, delete and insert rules; flush chains; zero counters.
  • Brouter facility.
  • Ability to atomically load a complete table, containing the rules you made, into the kernel. See the man page and the examples section.
  • Support for user defined chains.
  • Support for marking frames and matching marked frames.


Install ebtables:

Continue Reading…

Fixing an unbootable computer after a failed grub installation can be a bit tricky.
Here’s what I ended up doing.

First of all, boot the machine up and get access to the root partition:

Step 1. Get a Debian installation CD for the same architecture
The distro version doesn’t matter too much: a lenny CD will boot squeeze just fine.

Step 2.Boot the install CD and select Rescue mode under Advanced options.

Step 3. Answer the language, keyboard and network questions any way you want and provide the decryption passphrases for any of the encrypted partitions you need to mount.

Step 4.When prompted, request a shell on the root partition:
If you need to upgrade the version of the grub package

a) Make sure that the network interface is up (ifup eth0).
b) Make sure that /etc/resolv.conf has at least one nameserver line, otherwise add one.
c) Install the latest version using apt-get or dpkg.

Step 5.Now that you have the right grub version, run the following
:

grub-mkdevicemap

grub-install /dev/hda

update-grub

Step 6.Finally, reboot.

Enjoy

The Debian project is pleased to announce the first update of its stable distribution Debian 6.0 (codename squeeze).
This update mainly adds corrections for security problems to the stable release, along with a few adjustment to serious problems.

Please note that this update does not constitute a new version of Debian 6.0 but only updates some of the packages included. There is no need to throw away 6.0 CDs or DVDs but only to update via an up-to-date Debian mirror after an installation, to cause any out of date packages to be updated.

Those who frequently install updates from security.debian.org won’t have to update many packages and most updates from security.debian.org are
included in this update.

New CD and DVD images containing updated packages and the regular installation media accompanied with the package archive respectively will be available soon at the regular locations.

Upgrading to this revision online is usually done by pointing the aptitude (or apt) package tool (see the sources.list(5) manual page) to one of Debian’s many FTP or HTTP mirrors. A comprehensive list of mirrors is available at:

Continue Reading…