September5
Deluge is a torrent client for Linux. It’s cool because, as well as being well laid out, it also does magnet links for downloads. From a command window, install it with this command..
sudo apt-get install deluge
Next, we need to adjust the ports used by Deluge. Go CTRL + p to open the ‘P’roperties page. Click Network.
Uncheck the “Use random ports” boxes in bot Incoming and Outgoing channels sections.
Enter a value range in the ports boxes. The port values here can be anything you like in the 50,000 to 64,000 value range. Let’s say we chose 55055 to 55065. Enter these two values in the From and To boxes for both incoming and outgoing port numbers.
Once that’s done, you need to configure your firewall. If you’re using iptables, you’ll need to open some ports to get it working. Here’s the comand list to get you working…
sudo iptables -A INPUT -p tcp -m tcp --dport 55055:55065 -m state --state NEW -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 55055:55065 -m state --state NEW -j ACCEPT
sudo iptables -A OUTPUT -p tcp -m tcp --sport 55055:55065 -m state --state NEW -j ACCEPT
sudo iptables -A OUTPUT -p udp -m udp --sport 55055:55065 -m state --state NEW -j ACCEPT
The commands above allow tcp and udp in and out to the port range chosen, as required. Once that’s done, Deluge should work perfectly.
Nice.
September5
Sometimes you need to take a pic of a document say, and then put it into a pdf. Here’s how. In Linux.
You’ll need the awesome imagemagick package first. To install it, use..
sudo apt-get install imagemagick
Once that’s in, open a terminal window. Navigate to the folder you have the images in and then just run the command…
convert the_image.jpg the_document.pdf
Got multiple JPGs and need to squeeze all the images into the same pdf?
convert *.jpg the_document.pdf
Need to reduce the images to 1024 pixels across by whatever down and strip out meta data in the JPG files first though? Fer security and confidentiality?
mogrify -strip -resize 1024x *.JPG
“Nice one centurion, Like it.”
September23
This is a very simple and very effective procedure. Log on to your server and then log on to your database with the usual command..
mysql -u root -p
and enter your password.
Select your database using the command
USE your_database_name;
Then, use the following commands..
To copy the table and the data…
CREATE TABLE your_table_backup SELECT * FROM your_table;
To copy the table structure only, no data, use…
CREATE TABLE your_table_backup SELECT * FROM your_table LIMIT 0;
Nice.
September22
Configuration files often come with a lot of commentary. Documentation is always good, but sometimes you just want the red meat. Here’s how to see a file without all the ‘#’ commentary.
grep ^[^#] /etc/someconfig.conf
Golden.
September19
If you want to download a YouTube video, here’s how. First install the youtube-dl binary and the associated codecs…
sudo apt-get install youtube-dl ffmpeg libavcodec-extra-53
Once it installs, get your YouTube URL and simply run the command..
youtube-dl http://www.youtube.com/watch?v=Z3W05t79ZWY
to download the video. There are a load of other options you can use which are all shown thus..
youtube-dl --help
Conveniently, the youtube-dl command also does on-the-fly conversion of downloaded videos to just the .mp3 version for audio playback, thus…
youtube-dl http://www.youtube.com/watch?v=Z3W05t79ZWY -x --audio-format mp3
Where -x means ‘eXtract’. Again, there are a load of options here.
September18
Simple command that you sometimes need. Obviously this runs from the mysql client prompt, so open a command line and type
mysql -u root -p
and then enter the root password for your mySQL database.
Then, switch to your database…
USE yourdatabasename;
An now, all you need is..
SHOW columns FROM your_table;
OR
SELECT COLUMN_NAME' FROM 'INFORMATION_SCHEMA'.'COLUMNS'
WHERE 'TABLE_SCHEMA'='YOUR_DATABASE'
AND 'TABLE_NAME'='YOUR_TABLE';
Nice.