Archive

Archive for the ‘Just Learnt Something New (JLSN)’ Category

Installing Graphite

April 19, 2016 Leave a comment

Problem:
I needed to install graphite on a Ubuntu box on vagrant. The instructions on http://graphite.readthedocs.org/en/latest/index.html were not for the faint-hearted. But after 5mins on google I got the following guide from digitalocean.com.

Solution:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-graphite-on-an-ubuntu-14-04-server

Advertisements

Using Dnsmasq and nginx

March 11, 2016 Leave a comment

Problem:
How to point a localhost to a different name. Eg localhost -> fake.website.com for use in local development?

Solution:
One solution was dnsmasq. Simply updating /etc/hosts was not working for me. I think there was something else I was missing out on. Following the instructions on the website listed in the source section worked for me.

Source:
http://passingcuriosity.com/2013/dnsmasq-dev-osx/

sudo: Unable to resolve host (none)

October 26, 2015 Leave a comment

Problem:
I changed the host name of my machine from penguin to penguin_1 by editing both /etc/hosts and /etc/hostname.
After which I started getting the error “sudo: unable to resolve host (none)

Solution:
Found it on askubuntu hidden among the many answers. You can not have an underscore as a name. When I changed penguin_1 to penguin-1 in both files my issue was resolved.

Source:
http://askubuntu.com/questions/59458/error-message-when-i-run-sudo-unable-to-resolve-host-none

Interesting – Using Selenium

September 8, 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

Restart fluxbox off the command line

May 7, 2015 Leave a comment

Problem:
When switching between 1 and 2 screens, I kept on manually having to restart fluxbox.

Solution:
fluxbox-remote command allows me to restart fluxbox using a script. As I already have a script that does the switching between 1 and 2 screens this was pretty neat.

To configure
1. Edit ~/.fluxbox/init change

session.screen0.allowRemoteActions: false
to
session.screen0.allowRemoteActions: true

2. Restart fluxbox using the menu.

3. Open a terminal and run the following command

$ fluxbox-remote restart


Source:

https://www.linuxquestions.org/questions/slackware-14/how-do-i-run-menu-and-logout-from-the-command-line-in-fluxbox-864919/

Vim – Using undo branches

April 16, 2015 Leave a comment

This is a pretty neat feature that I did not know existed. I have only used u, U and CTRL-R, but a situation arose where multiple undo’s and redo’s was necessary.

:h undolist has clear documentation on how it works.
g+ Go to newer text state. With a count repeat that many times. {not in Vi} See :help g+ for more.
g- Go to older text state. With a count repeat that many times. {not in Vi} See :help g- for more.

For more, see below:
http://vim.wikia.com/wiki/Using_undo_branches