Archive

Archive for October, 2015

gpg

October 28, 2015 Leave a comment

Notes

$ gpg –local-user -a –detach-sign

$ gpg –fingerprint

$ gpg –send-key –keyserver hkp://keys.gnupg.net

To get your public key
$ gpg gpg –armor –export

To decrypt file that was shared with you
$ gpg –output


For this version of gpg

gpg (GnuPG/MacGPG2) 2.0.28
libgcrypt 1.6.3
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Categories: bash Tags:

How to use *args and **kwargs in Python

October 28, 2015 Leave a comment
Categories: python Tags: ,

Mosh – Mobile Shell

October 26, 2015 Leave a comment

Mosh (mobile shell)

Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes.

Mosh is a replacement for SSH. It’s more robust and responsive, especially over Wi-Fi, cellular, and long-distance links.

Mosh is free software, available for GNU/Linux, FreeBSD, Solaris, Mac OS X, and Android.

https://mosh.mit.edu/

Categories: Interesting

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

Import Error: No module named django.core.wsgi

October 23, 2015 Leave a comment

Problem:
I have an nginx + django + wsgi setup. When I try to bring up the site I was getting the import error.

Solution:
Found a solution on stackoverflow. Turns out that wsgi was not able to find django in my site-packages. Following the pointers in the stackoverflow link below, I updated my sys.path and that fixed the issue.

import os
import sys

sys.path.append("/usr/share/python/<my_project_name>/lib/python2.7/site-packages")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "<my_project_name>.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Source:
http://stackoverflow.com/questions/14927345/importerror-no-module-named-django-core-wsgi-apache-virtualenv-aws-wsgi

Strings – Python 3

October 16, 2015 Leave a comment

Few people think about it, but text is incredibly complicated. Start with the alphabet. The people of Bougainville have the smallest alphabet in the world; their Rotokas alphabet is composed of only 12 letters: A, E, G, I, K, O, P, R, S, T, U, and V. On the other end of the spectrum, languages like Chinese, Japanese, and Korean have thousands of characters. English, of course, has 26 letters — 52 if you count uppercase and lowercase separately — plus a handful of !@#$%& punctuation marks.

Read the full article here

Categories: Interesting, python