Skip to main content

Posts

Showing posts from October, 2016

Useful, but rarely used git commands

Some useful, but rarely used and hence easy to forget git commands. Recording these here as a note to myself.

PurposeCommandDelete a Remote Taggit push --delete origin <tagname>Filenames diff between two commitsgit diff commit commit2 --statList all tags, sorted by name, in reversegit tag -l --sort="-v:refname"

How to Create a Random String

Random strings are used everywhere in computing -- mostly as keys for cryptographic signing sensitive data. So how does one go about creating one?

My first thinking was to use Python code and its random library. I came up with this

import string import random def gen_random_string(length=32, charset=string.printable): ''' A function to generate a string of specified length composed of random characters. The characters with which the string is composed can be customized thru the second parameter. Parameters: length - int, length of the string. Defaults to 32. charset - array of characters from which the letters to compose the string are randomly chosen. Defaults to string.printable Returns: string Raises: None ''' num_chars = len(charset) random_string = '' random.seed() for i in range(0, length): random_string += charset[random.randint(0, num_char…

Script to Create Secure Django Site Deployment Environment

My first production level shell script is out. Yes, after two decades spent in the depths of code, I have finally published a shell script that is worthy of being called 'code'.

It's something that started as a few lines hack to update a Linux box with a series of packages that needed to be installed to deploy a Django web app that eventually grew to 300+ lines of madness (I can't find anything else to describe shell scripting language) that I have used to create consistent configuration across a few servers.

Without much ado, here it is: https://github.com/harikvpy/deploy-django.git.

Script to Create Secure Django Site Deployment Environment

My first production level shell script is out. Yes, after two decades spent in the depths of code, I have finally published a shell script that is worthy of being called 'code'.

It's something that started as a few lines hack to update a Linux box with a series of packages that needed to be installed to deploy a Django web app that eventually grew to 300+ lines of madness (I can't find anything else to describe shell scripting language) that I have since used to create consistent configuration across a few servers and apps.

Without much ado, here it is: https://github.com/harikvpy/deploy-django.git.