pip failed to install package

March 17, 2017 Leave a comment

Note to future self:

When installing a python package in a virtualenv using pip ie

pip install -r requirements.txt

If it fails to build and gives an error about something or the other.
Do a pip freeze and do a diff between what was installed and what is listed in requirements.txt

If there is a diff. Upgrade your pip version.

sudo pip install --upgrade pip

Try running the install again.

Categories: python Tags:

How to Run Python Tests “Continuously” While Coding

March 17, 2017 Leave a comment

Last week I was doing some Test Driven Development training and overheard someone mention another programming language that had a test runner that you could set up to watch your project directory and run your tests when the files changed.

http://www.blog.pythonlibrary.org/2017/03/14/how-to-run-python-tests-continuously-while-coding/

Categories: Interesting, python

Convert .iso to .mp4

March 15, 2017 Leave a comment

Problem:
A colleague asked to convert .iso files to .mp4

Solution:
Installed and used Handbrake to do the conversion.

HandBrake is a tool for converting video from nearly any format to a selection of modern, widely supported codecs.

Reasons you’ll love HandBrake:

Convert video from nearly any format
Free and Open Source
Multi-Platform (Windows, Mac and Linux)

Source:
https://superuser.com/questions/329349/how-do-i-convert-iso-to-mp4-without-mounting-with-ffmpeg

Categories: Interesting

Meet Cachet – The open source status page system

March 3, 2017 Leave a comment

Cachet is a beautiful open source status page system, used by large household names, airports, schools and businesses.

* List your services components
* Log incidents
* Apply custom CSS to the status page
* Markdown support for incident messages
* JSON API
* Translated into eleven languages
* Metrics
* Cross-database support: MySQL, PostgreSQL and SQLite
* Subscriber notifications via Email
* Two factor authentication, with Google Authenticator

https://cachethq.io

Categories: Interesting

https://crontab.guru

February 28, 2017 Leave a comment
Categories: Interesting

PostgreSQL – Create users and assign roles

January 25, 2017 Leave a comment

1. Create role.

CREATE ROLE myuser LOGIN PASSWORD 'mypassword';

2. Alter role.

ALTER ROLE myuser CREATEDB CREATEROLE;

3. Create database.

$ createdb mydatabase -U myuser -h 127.0.0.1 -p 5432;

4. Connect as new user.

psql -h 127.0.0.1 -p 5432 -U myuser;

5. Delete role

DROP OWNED BY myuser cascade;
DROP ROLE myuser;
$sudo -u postgres psql postgres
psql (9.4.10)
Type "help" for help.

postgres=# CREATE ROLE myuser LOGIN PASSWORD 'mypassword';
CREATE ROLE
postgres=# \dg
                                List of roles
   Role name    |                   Attributes                   | Member of
----------------+------------------------------------------------+-----------
 myuser         |                                                | {}
 postgres       | Superuser, Create role, Create DB, Replication | {}
 
 vagrant        |                                                | {}

postgres=# ALTER ROLE myuser CREATEDB CREATEROLE;
ALTER ROLE
postgres=# \dg
                                List of roles
   Role name    |                   Attributes                   | Member of
----------------+------------------------------------------------+-----------
 myuser         | Create role, Create DB                         | {}
 postgres       | Superuser, Create role, Create DB, Replication | {}
 
 vagrant        |                                                | {}

postgres=#\q



$ psql -h 127.0.0.1 -p 5432 -U myuser;
Password for user myuser:
psql: FATAL:  database "myuser" does not exist



$ createdb mydatabase -U myuser -h 127.0.0.1 -p 5432; 
Password:



$ psql -h 127.0.0.1 -p 5432 -U myuser -d mydatabase; 
Password for user myuser:
psql (9.4.10)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

mydatabase=> \dt
No relations found.

mydatabase=> \q

Source:
https://www.postgresql.org/docs/current/static/sql-createrole.html
http://grokbase.com/t/postgresql/pgsql-patches/068m331a82/drop-owned-by-doesnt-work

Categories: notes, postgresql Tags: ,

end-to-end-encryption-with-openshift-part-1-two-way-ssl

January 25, 2017 Leave a comment

This is the first part of a 2 part article, part 2 (End To End Encryption With OpenShift Part 2: Re-encryption) will be authored by Matyas Danter, Sr Consultant with Red Hat, it will be published soon. This article aims to demonstrate use cases for Openshift routes to achieve end-to-end encryption. This is a desirable and sometimes…

via End To End Encryption With OpenShift Part 1: Two-Way SSL — RHD Blog

Categories: Interesting