bash

Generating Bash art with an ASCII Generator

  • Posted on: 14 March 2017
  • By: davis

http://patorjk.com/software/taag/

Example output below:

#     _____                           _         _______           _   
#    / ____|                         | |       |__   __|         | |  
#   | (___    __ _  _ __ ___   _ __  | |  ___     | |  ___ __  __| |_ 
#    \___ \  / _` || '_ ` _ \ | '_ \ | | / _ \    | | / _ \\ \/ /| __|
#    ____) || (_| || | | | | || |_) || ||  __/    | ||  __/ >  < | |_ 
#   |_____/  \__,_||_| |_| |_|| .__/ |_| \___|    |_| \___|/_/\_\ \__|
#                             | |                                     
#                             |_|                                     

Amazing software. Make sure to click "More opts" and select "Echo Commands" under the "Format the output" option.

There are hundreds of formatting options, you can choose your output format for easy inclusion in shell scripts, and you can preview all of the styles at once.

 

Fixing missing libssl library when using Django/Anaconda

  • Posted on: 16 November 2016
  • By: davis

Here's the fix for this error message on OSX: 

raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(/Users/anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: libssl.1.0.0.dylib

 

Bash - Get Name of Parent Directory

  • Posted on: 2 March 2016
  • By: davis

For the path /foo/bar/, if the current directory is bar, and we want to get the name of the parent directory (i.e. foo)

path="$( cd "$( dirname $0 )" && cd -P "$( dirname "$SOURCE" )" && pwd )"
parentName=$(basename -- "$(dirname -- "$path")")
echo $parentName # will return parent directory's name

This resolves symbolic links (sidestepping the error where it returns "." for the parent dir). Give it a try.

Alternative to Cron for NearlyFreeSpeech Users

  • Posted on: 16 February 2016
  • By: davis

I use the server host NearlyFreeSpeech for all of my personal website-related things nowadays. They are extremely cheap, and their community-driven support is great.

Unfortunately, they don't have crontab enabled. Here's a workaround for enabling cron-like functionality on a NearlyFreeSpeech hosting instance.

In my case, I needed to curl multiple public-facing URL's in order to refresh some vital information. I wanted to do that on a schedule.