Category Archives: Linux

Automated encrypted backups to megaupload.

I’ve written a little script to automatically upload a backup of a folder i want, to megaupload.It encrypts the file by using gpg standards, then uploads the file using plowshare. It also creates a filecalled ~/Dropbox/Backup.txt, which stores a record of each and every backup. Including the md5 hash of the encrypted file.Since i have a free account in Megaupload, i store backups for 90 days.. after which it will be dead, but who needs backups older than 90 days right?

Safe, Secure and Easy.

#!/bin/bash
#Written by unhackmunhackmee.wordpress.com

USR=#Username
 PASS=#Pass
 Recipient=me@gmail.com
 Record=~/Dropbox/Backups.txt
 #Set folder to ""; to nullify
 FOLDER="";
 if [ $# -ne "0" ];then FOLDER=$1;
 else
 if [ -z $FOLDER ];then
 echo ERROR! No input files! && exit;
 fi
 fi

DATE=`date +%d%m%y-%H%M`
 gpg-zip --recipient $Recipient --encrypt --output /tmp/$DATE.pgp $FOLDER
 MeURL=`plowup -a $USR:$PASS /tmp/$DATE.pgp megaupload`
 MD5=`md5sum /tmp/$DATE.pgp`
 echo -e "$MD5\t$MeURL\t`date +%D-%H:%M`\t$FOLDER" >> $Record
 echo >> $Record

im thinking of adding this to the cron tab, but the thing has to be run as a normal user,
(doesn’t need root powers)- i haven’t done so because gnome & unity- both seem too oft to
crash on me.btw, you need plowshare and gpg installed, and the recipient’s key should be trusted, or gpg prompts to warn you.

Conky on ubuntu 11.04, (Natty Narwhal) netbook

This month, natty narwhal is going to hit the shelves officially, but i grew a little impatient and grabbed a copy anyhow. Its functional for the most parts.. The dropbox needed a little help to get set up (hey- it hasnt been updated for natty yet…)

This version brings a desktop to the Netbook version after, what i  remember as two steps of no desktop versions.  And with a desktop – comes opportunity.. Without further ado… I present to you : My Netbook Conky

First of all, you need to install conky. After you initially run it, you can edit ~/.conkyrc by using:

gedit ~/.conkyrc

Paste in the following code for the right column conky.

#modified by Unhackmee - unhackmee.wordpress.com
background no
font Sans:size=10
xftfont Sans:size=10
use_xft yes
xftalpha 0.9
update_interval 3.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 5
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color grey90
default_shade_color white
default_outline_color green
alignment top_right
gap_x 12
gap_y 35
no_buffers yes
uppercase no
use_spacer right
#colors
# orange
color3 FC8820
cpu_avg_samples 2
override_utf8_locale no
uppercase no # set to yes if you want all text to be in uppercase
text_buffer_size 2048
TEXT
${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}System Information${font}  ${hr}${color}
Name: $alignr$nodename ($machine)
Kernel: $alignr$sysname/$kernel
Uptime: $alignr$uptime
Battery: ${color white}${battery_percent BAT1}%${color} - ${battery_bar BAT1}
 ${alignr}${battery_time BAT1}
Root:${fs_free /} / ${fs_size /} - ${fs_bar 8 /}

${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}Processor Details${font}  ${hr}${color}
CPU: ${alignr}${freq} MHz
Processes: ${alignr}$processes ($running_processes running)
Load: ${alignr}$loadavg

${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}System Memory ${font}  ${hr}${color}
CPU1: ${cpu cpu1}% ${tab 5} ${cpubar 8 cpu1}
CPU2: ${cpu cpu2}% ${tab 5} ${cpubar 8 cpu2}
 RAM: $memperc% ${tab 5} ${membar 8}
Swap: $swapperc% ${tab 5} ${swapbar 8}

${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}CPU Loads${font}  ${hr}${color}
${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${top name 3}$alignr${top cpu 3}${top mem 3}

${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}WIFI Network${font}  ${hr}${color}
WIFI bitrate: ${wireless_bitrate wlan0} Mbps
WIFI quality: ${wireless_link_bar wlan0}
IP Adress:    ${addr wlan0}
Down ${downspeed wlan0} k/s ${alignr}Up ${upspeed wlan0} k/s
${downspeedgraph wlan0 25,107} ${alignr}${upspeedgraph wlan0 25,107}
Total ${totaldown wlan0} ${alignr}Total ${totalup wlan0}

Before we go on, you need to install conkyforecast from its ppa in launchpad:

https://launchpad.net/~conky-companions/+archive/ppa/+files/conkyforecast_2.18_all.deb

Read how to set it up at ubuntuforums. After you have a working setup, continue on.

So the second one, you can name .conky1 and put it in the home folder too.. (ofcourse if you dont like the name, be sure to change the startup script too :P). The weather is set to show Maldives, but ofcourse you should change it to your location before saving.

# conky configuration
# edited by Mark Buck (Kaivalagi)
# modified later-on by unhackmee - unhackmee.wordpress.com
background yes
use_xft yes
xftfont Bitstream Vera Sans Mono:size=9
xftalpha 0.8
update_interval 1.0
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop
# Required to be true if you still want to store files on desktop.
own_window yes
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 300 0
maximum_width 275
# Draw shades?
draw_shades yes
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
draw_graph_borders yes

# Stippled borders?
stippled_borders 8

# border margins
border_margin 0

# border width
border_width 0

# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color white

# own window options
own_window        yes
own_window_transparent    yes
own_window_type        override
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_left

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 465
gap_y 255

# Subtract file system buffers from used memory?
no_buffers yes
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer right

# colours
color1 white
# light blue
color2 6892C6
# orange
#E77320
color3 FC8820
# green
color4 78BF39
# red
color5 CC0000

text_buffer_size 2048

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument

# stuff after 'TEXT' will be formatted on screen

TEXT
${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}Weather${font}  ${hr}${color1}
${execpi 1800 conkyForecast --location=MVXX0001 --template=/usr/share/conkyforecast/example/conkyForecast.template}

and now open up Compiz (power button>>System Settings>>Search) , go to Window Decorations, and in the “Shadow windows” text box write:

 any & !(class=Conky)

Now when you start conky, if the right column shows up correctly (dont worry about the other one yet) its time to add the thing to startups.
* Make a new file called ~/.conkyStart.sh or something of the short.. and put :

#!/bin/bash</pre>
sleep 3 &&
conky -d -c /home/unhackmee/.conky1 &
sleep 10 &&
conky -d -c /home/unhackmee/.conkyrc &
exit

Now go and add that to startup applications in ubuntu (remember chmod +x .conkyStart.sh )  😀

Note>> Please remember that this is a script made for a netbook and therefore adjusted to fit on the smaller screen.. All other screensizes should expect to have some experimenting to do.
away with ye!

Creating a (netbook) download rig

A netbook is perfect to be used as a download rig, as it is made with battery life in mind, and consumes way less power than even a laptop (not to mention desktops). Yet, it has enough processing power to upload and download stuff.. so- for those that dont want ‘just’ a download rig- a nebook is the next best thing. So here i kinda log what a plan to configure (a set-up if you will)…

  • jdownloader which starts at boot.
  • Transmission client.
  • lighttpd which serves the download folder to those who give a …

… Jdownloader has a web-access plug-in, as does Transmission. Both these can downlaod files to the lighttpd www folder… and plus, running jdownloader without graphical mode, in tty2 proves to require lesser resources

Note:These are meaningless notes, Do NOT try to make head or tail of it – lest you may start seeing tails on the middle and heads on that tail. (pun fully inteded). Me no responsible

Multi-Dropbox setup

Dropbox is neat. really neat. real good too. 2Gig for a free user when they start. Not to mention the really cool nautilus extension they have for ubuntu linux.

The thing is hellishly addictive and the super-sleek sync feature leaves the heart wanting more. So now i have two dropbox accounts set-up and and combined with my ubuntu-one account, that makes a total of 6GB in pure sync-ready clouds in my little netbook.

IF you dont already have one, get a dropbox account now (2.25 GB FREE)

Here is how to configure a second dropbox account in ubuntu 10.10 netbook edition:

1. Dont be shy, go on and fire-up the terminal.

mkdir /home/username/.dropbox-shared

HOME=$HOME/.dropbox-shared /home/username/.dropbox-dist/dropbox start -i

2. Complete the setup, and choose selective sync (advanced) , and sync only the Public folder.. Now add dropbox so that it will autostart.

Applications>>System>>Startup-applications

add:

‘HOME=$HOME/.dropbox-shared  /home/username/.dropbox-dist/dropbox start`

3. After that, exit all instances of the second dropbox. now symlink the Public folder in your home dir with the Public folder in ~/.dropbox-shared/Dropbox/Public

4. Hopefully, thats that and the end of this madness, so now – my Public folder syncs with a second dropbox account, that i plan to use sole-ly for public purposes. Its all done and the whole thing costs nada.

Kudos.

FREE Dropbox with initial 2.25Gig space

Friendly Note: The icons are part of an icon set,search for it – its made by Incognitus..