Create public/private key

August 28, 2015 Leave a comment

To Generate your public/private keys

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/rodnee/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/rodnee/.ssh/id_rsa.
Your public key has been saved in /home/rodnee/.ssh/id_rsa.pub.

Go ahead and share your public key with the other party.

Categories: bash Tags: ,

Whiptail – Site with examples

August 28, 2015 Leave a comment

Working with Redis

August 27, 2015 Leave a comment

What is Redis?

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Download from http://redis.io/download and follow the installation instructions.

1. Start up the server

$ ./redis-server

                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 17983
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

17983:M 27 Aug 09:29:46.683 # Server started, Redis version 3.0.3
17983:M 27 Aug 09:29:46.683 * DB loaded from disk: 0.000 seconds
17983:M 27 Aug 09:29:46.683 * The server is now ready to accept connections on port 6379

2. Connect to the server using the commandline interface.

$ ./redis-cli
127.0.0.1:6379> set "HLR:34" "{bar:'rab', foo:'oof'}"
OK
127.0.0.1:6379> get "HLR:34"
"{bar:'rab', foo:'oof'}"

# To clear the database.
127.0.0.1:6379> flushdb
OK

# To quit.
127.0.0.1:6379> quit

Source:
redis.io

Advanced Json manipulation with python

August 27, 2015 Leave a comment

Working with json:

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> produce = {"mangoes": 4, "oranges": 1, "bananas": 5}
>>> json.loads(produce)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

>>> json_string = json.dumps(produce)
>>> json.loads(json_string)
{u'mangoes': u'4', u'bananas': u'5', u'oranges': u'1'}

Source:

http://www.yilmazhuseyin.com/blog/dev/advanced_json_manipulation_with_python/

Graphite

August 27, 2015 Leave a comment
Categories: Interesting

Crash Tolerant Data Storage

August 26, 2015 Leave a comment
Categories: Interesting

Ubuntu – Changing locale settings

August 25, 2015 Leave a comment

Problem:
I kept on seeing the below perl warnings when running apt-get install on my virtual machine. (Ubuntu Trusty 64 bit)


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Running locale shows some errors

vagrant@vagrant-ubuntu-trusty-64:~$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Running dpkg-reconfigure locales also has some errors

$ sudo dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US",
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.

The following two commands did not solve the issue for me either.

$ sudo local-gen “en_US.UTF-8”

OR

$ sudo apt-get install language-pack-UTF-8

Solution:
What finally worked for me adding the following three lines to /etc/environment file.

LANG="en_US.UTF-8"
LANGUAGE="en_US"
LC_ALL="en_US.UTF-8"

Save the change, logout and reboot virtual machine.

To check to see if errors have gone away I re-ran ‘locale’ and ‘sudo dpkg-reconfigure locales’ commands

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

sudo dpkg-reconfigure locales
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.

Source:
http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue

Follow

Get every new post delivered to your Inbox.

Join 41 other followers