linux poison RSS
linux poison Email
2

Install Spotify Client in Ubuntu 12.04

Spotify is a Swedish music streaming service offering digitally restricted streaming of selected music from a range of major and independent record labels, including Sony, EMI, Warner Music Group, and Universal. Launched in October 2008 by Swedish startup Spotify AB

A six month free trial period is activated upon initial login with a Facebook account, where a user can listen to an unlimited amount of music supported by visual and radio-style advertising. After the trial, Spotify will have a listening limit of ten hours per month. An "Unlimited" subscription removes advertisements and time limits and a "Premium" subscription introduces extra features such as higher bitrate streaming, offline access to music and mobile app access. An active Facebook account is required to use Spotify.

Read more
0

Bash Script: Find and replace string within string

Below is a simple bash script which will find and replace the substring withing the string. Feel free to use or modify this script.

Source: cat stringreplace.sh
#!/bin/bash

echo -n "Enter main string: "
read string

echo -n "Enter the sub-string that you want to replace: "
read old

echo -n "Enter new sub-string that you want to replace with: "
read new

echo "The new string is now: ${string/$old/$new}"

Result: ./stringreplace.sh 
Enter main string: linuxpoison
Enter the sub-string that you want to replace: poison
Enter new sub-string that you want to replace with: os
The new string is now: linuxos

Read more
0

Bash Script: Array examples and Operations

Below is a simple script which demonstrate all the different kind of array operations like ...

 * Display arrays elements
 * Iterate through the array elements
 * Add a new element to array
 * Replace an array element
 * Copy array
 * Delete array

Source: cat array.sh
#!/bin/bash

array=(a b c d)

# Get the lengthe of array
LEN=${#array[*]}
echo "Length of the array is: $LEN"

# Print the array elements"
echo "${array[@]}"
echo "----------------------------------"

# Iterate through the array
for ((i=0;i<${#array[*]};i++)); do
    echo "$i : ${array[$i]}"
done
echo "---------------------------------"

# Add new value to the end of the array
array=("${array[@]}" "e")
array[10]="f"   # Add another element at index 10
echo "${array[@]}"
echo "---------------------------------"

# Copy the array to another array
declare -a newarray
for i in ${array[@]}; do
    newarray[${#newarray[*]}]=$i
done
echo "New array values: ${newarray[@]}"
echo "----------------------------------"

# Remove a element from the array
unset array[2]
echo "${array[@]}"
echo "---------------------------------"

# Replace a array element
array[0]="z"
echo "${array[@]}"
echo "---------------------------------"

# Delete entire array
unset array
echo "${array[@]}"

Read more
1

Setting up GlusterFS Network Storage under Ubuntu

GlusterFS is an open source, distributed file system capable of scaling to several petabytes (actually, 72 brontobytes!) and handling thousands of clients. GlusterFS clusters together storage building blocks over Infiniband RDMA or TCP/IP interconnect, aggregating disk and memory resources and managing data in a single global namespace. GlusterFS is based on a stack-able user space design and can deliver exceptional performance for diverse workloads.

GlusterFS supports standard clients running standard applications over any standard IP network. No longer are users locked into costly, monolithic, legacy storage platforms. GlusterFS gives users the ability to deploy scale-out, virtualized storage – scaling from terabytes to petabytes in a centrally managed and commoditized pool of storage.

Attributes of GlusterFS include:
 * Scalability and Performance
 * High Availability
 * Global Namespace
 * Elastic Hash Algorithm
 * Elastic Volume Manager
 * Gluster Console Manager
 * Standards-based
Read more
0

E-Mail count and notifications for Ubuntu desktop - Unity Mail

Unity Mail is an E-Mail count and notifications application for Ubuntu Unity desktop, is a script that checks your mail on any IMAP4-compatible server and displays a notification bubble when you get new mail;

Unity Mail Features:
* Works with any IMAP4-compatible server
* Multiple accounts support
* Unread messages count on the Launcher
* Unity Quick-list support (GMail URLs by default)
* Messaging Menu integration
* NotifyOSD notifications

Unity Mail is written in Python and is currently in Beta development phase.

Read more
4

Bash Script : Iterate over command line arguments

Below is simple bash script to calculate the average of integer numbers passed to the script from the command line arguments.

$#  - give the value of total number of argument passed to the script
$@ - using this we can  Iterate over command line arguments.

$ cat average.sh
#!/bin/bash

SUM=0
AVERAGE=0
ARG=$#
for var in "$@"; do
        if [ "$var" -eq "$var" 2>/dev/null ]; then
                if (( "$var" == 0 || "$var" > 100 )); then
                        echo "Invalid entry (ignored): $var"
                        ARG=$(($ARG-1))
                else
                        SUM=$(($SUM+$var))
                fi
        else
                echo "Invalid entry (ignored): $var"
                ARG=$(($ARG-1))
        fi
done
echo
AVERAGE=$(($SUM/$ARG))
echo "Average is : $AVERAGE"
echo

Output: 
$./average.sh 2 2 3.4 2 2 4.5 1001 0
Invalid entry (ignored): 3.4
Invalid entry (ignored): 4.5
Invalid entry (ignored): 1001
Invalid entry (ignored): 0

Average is : 2


Feel free to modify or use this script.

Read more
4

Creating Labels and Business Cards - gLabels

gLabels is a program for creating labels and business cards for the GNOME desktop environment. It is designed to work with various laser/ink-jet peel-off label and business card sheets that you'll find at most office supply stores. gLabels is free software and is distributed under the terms of the GNU General Public License (GPL).

Installing Glabels:
Glabels package is available in the default available repository under Ubuntu, you can search "Glabels" and install it using Software Center or can install it using command:
sudo apt-get install glabels
After successful installation, you can open the glabels application from Unity 'Dash'

Read more
2

Bash Script: Read the passwod without showing on the screen

Here is an simple bash script which reads the password value from a user and does not show the same on the screen.

Feel free to modify and use this script.

Source:
$ cat readpass.sh 

#!/bin/bash
echo -n "Enter your username: ";
read username
echo -n "Enter your passwd: "
read -s passwd
echo
echo "$username, your passwd is $passwd";

Output:  
$ ./readpass.sh
Enter your username: nikesh
Enter your passwd:
nikesh, your passwd is linuxpoison


Read more
0

Powerful Text Editor for Markdown and reStructuredText - ReText

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

Thus, “Markdown” is two things:
 * A plain text formatting syntax
 * A software tool, written in Perl, that converts the plain text formatting to HTML.

reStructuredText is an easy-to-read, what-you-see-is-what-you-get plain text markup syntax and parser system. It is useful for in-line program documentation (such as Python docstrings), for quickly creating simple web pages, and for standalone documents. reStructuredText is designed for extensibility for specific application domains. The reStructuredText parser is a component of Docutils.
Read more
Related Posts with Thumbnails