Thursday, 27 March 2014

How To Create A Bootable USB In Debian

Yes, Unetbootin is a great tool, but for some reason I can't get it to work in Debian. Fortunately you can achieve the same by using the command line and it is nearly as straightforward as using unetbootin.


Creating Bootable USB In Debian


First, we want to get the exact name of our USB device.

sudo fdisk -l

The output should be similar to mine.

Disk /dev/sdb: 2013 MB, 2013265920 bytes 

Now that we now the location, we want to write our .iso or .img file to the USB.

dd if='/home/user/Downloads/linuxmint-201403-mate-dvd-64bit.iso' of=/dev/sdb

This will take some time, so be patient and do not interrupt the process.

Sunday, 16 March 2014

Automatically Reconnect WIFI (Debian, Ubuntu etc.)

The Problem

For several reason I do not have access to LAN and thus have to rely on WIFI for my mining rigs. It is fine for most of the time, but the shit hits the fan, when the connection drops for one reason or another.


The Solution
#!/bin/bash

wlan=`/sbin/ifconfig wlan1 | grep inet\ addr | wc -l`
if [ $wlan -eq 0 ]; then
service network-manager restart
else
echo WIFI IS UP
fi
Note: It's either wlan0 or wlan1. Check with sudo ifconfig.

Save the script and make it executable.

sudo chmod +x filename.sh

Now there are several ways of making sure that our script is being executed every x minutes. The easiest way of accomplishing that I think is by using the command watch.
sudo su
watch -n 600 sh filename.sh

What it does is execute our filename.sh script every 600 seconds.

Or you implement a so called cron job  

sudo crontab -e

Add the following

PATH=/usr/sbin:/usr/bin:/sbin:/bin
*/5 * * * * sh /home/username/filename.sh

*/5 * * * * means that the task will run every 5 minutes.

Monday, 3 March 2014

Adding a Watermark To a Video Via Shell

Recently I wanted to add a watermark to one of my videos. Obviously there are two possible ways of achieving this in Linux.

 
Sample Watermark


Via command line
avconv -i input.mpg -vf “movie=watermark.png [watermark];[in][watermark] overlay=0:0 [out]” -c:v mpeg2video -an output1.mpg 

Via Openshot (text)

Openshot Video Editor is a free, open-source video editor for Linux licensed under the GPL version 3.0. http://www.openshot.org/

sudo apt-get install openshot

Open the program.
CTRL + T
Choose Footer
Create New Title: <Enter your watermark>
First color option: Pick your desired colour
Second color option: Set Opacity to 0
Apply and drag and drop to Track.

Sunday, 2 March 2014

Saturday, 1 March 2014

Public Key Authentication SSH (Debian, Ubuntu)

Generate RSA keys on Client

mkdir ~/.ssh 
chmod 700 ~/.ssh 
ssh-keygen -t rsa -b 4096

Transfer Client Key to Host

ssh-copy-id username@host

Test

ssh username@host

Disable Password Authentication On Host

sudo nano /etc/ssh/sshd_config


Look for <#PasswordAuthentication yes> and change it to <no>.

Restart SSH

sudo service ssh restart

DONE