Automation is supposed to let you slack more.

Tuesday, November 07, 2017

Fix init sequence in Raspberry Pi

If the init sequence gets broken and you can't get to a shell on a Raspberry Pi (I'm using 3 model B), you can boot into recovery mode this way.
  • Hit shift when starting up.
  • Hit "e" to edit config
  • tab over to cmdline.txt
  • add to the end of the line
  • hit ok, then Esc to boot...... it will boot you in to a command line
    # mount -n -o remount,rw / (this will remount / so you can make changes)
  • now you should be able to edit the init.d config.
  • when you reboot again.... hold shift and remove the init=/bin/sh

Friday, November 03, 2017

Thursday, November 02, 2017

Friday, October 13, 2017

Verifying OpenSSL certificates

Verifying that a certificate is issued by a CA

How to use OpenSSL on the command line to verify that a certificate was issued by a specific CA, given that CA's certificate:
$ openssl verify -verbose -CAfile cacert.pem  server.crt
server.crt: OK

Verify that a private key matches a certificate

$ openssl x509 -noout -modulus -in server.crt | openssl md5
$ openssl rsa -noout -modulus -in server.key | openssl md5
The resultant hashes should match.

Thursday, September 28, 2017

Chaining class decorators

The last (i.e. outer) decorator's behavior gets executed first.
def require_authentication_permission(permission):
    def decorator(cls):
        cls.dispatch = method_decorator(
                permission, raise_exception=True)
        cls2 = class_login_required(cls)
        return cls2

    return decorator
In this case, the execution order is:
  1. class_login_required
  2. permission_required

Monday, September 25, 2017

Logging in Django

To log to console in Django. Source: Logging | 

    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),

File that uses logging

import logging
logger = logging.getLogger('django')

Write to log'Hello')

Tuesday, September 19, 2017

Popular Posts

Recent Posts

Unordered List

Text Widget


Powered by Blogger.
Scroll To Top