Password generator in Linux terminal

Here’s an easy way to get random passwords via Linux terminal. First, you need to install pwgen .

pwgen

Now, write a bash script named password.sh with either nano, vim or any text editor of your choice. This is how to do it:

password

Save  password.sh , then make it executable
chmod +x password.sh
Then launch
./password.sh

The script will ask for Character Length:

Enter the number of characters you wish to use and you will get and random password. The script goes back to prompt automatically so if you need another password, re-launch the script and generate a new password.

~ teklordz

Advertisements

Bitcoin prices in real time from the coindesk website api

A while back, i was searching the web for a bitcoin bash script. The only one i found was on David Walsh’s website.  The script uses the Coindesk bitcoin API and allows to get the average price of bitcoin in USD currency. You can also use the EUR or BGP currency in that script.

The problem for me is that after giving the price, the script went right back to prompt. What i needed was a script that would not go back to prompt and that would update the price automatically in 3 different currencies. So i did some research and modified the script from David. Make sure CURL is installed on your system.

First, open your Linux terminal and type:

nano

*You can also use VIM or any text editor.

Once in nano, copy&paste the following:

#!/bin/bash
# Credit to David Walsh for the original script
# The improved version of David’s script doesn’t go back to prompt. It keeps refreshing the prices every 5 seconds.
# Prices are in USD, EUR & GBP (in real time)
# curl must be installed in terminal
clear
date
date -u
echo “Coindesk BTC: ”
echo ” USD                     EUR                     GBP ”
while [ 1 ]
do
curl -s http://api.coindesk.com/v1/bpi/currentprice.json | python -c “import json, sys; bitcoin=json.load(sys.stdin); print bitcoin[‘bpi’][‘USD’][‘rate’] + ‘\t’ + bitcoin[‘bpi’][‘EUR’][‘rate’] + ‘\t’ + bitcoin[‘bpi’][‘GBP’][‘rate’]”
printf “\033[A”
sleep 5
done

I added date and date -u to get a time stamp for the script, since i often post screenshots on twitter. But this is totally optional.

To save in nano, Ctrl + x then y. Now, you need to make it executable. (you need to do this just once).

chmod +x btc.sh
Now, you can run the script with:
./btc.sh then press on enter. To exit, just use Ctrl + c

~ teklordz