Monthly Archives: December 2021

Linux

Certbot Adding Domain to a Cert

I self-host my websites because, well I’m a computer geek and that’s what we do. Back in the dark ages, we used to pay out the nose for SSL certificates to protect the site content in transit. To this day I won’t deal with GoDaddy because of an issue with that. But then LetsEncrypt was formed by the industry heavyweights and offered free SSL certs for your self-hosting needs.

As I like registering domains on whims, I need to secure them when I bring them up and here’s what you need to do.

First, look up the certificates that you have with:
certbot certificates

Then add the domain you want to at the end of the list, in this case, domain4.com:
certbot certonly –cert-name [CERTNAME] -d domain1.com,domain2.com,domain3.com,domain4.com

Python

Python – Merge CSV’s

I’m really enjoying python, one of the things that I’m really digging is pandas, this piece lets you work with CSV files to do a multitude of things. Because you have to pull out data in a loop, this little piece of code will allow you to stitch them together. This sample uses pipe delimiters with UNIX line feeds and quoted all.

import os
import glob
import pandas as pd
import csv
#os.chdir("C:\\onedrive_tt\\Testing\python\\CombineCSVs\\testApplicationFiles")
os.chdir("C:\\app\\python\\CombineCSVs\\testApplicationFiles")

extension = 'csv'
all_filenames = [i for i in glob.glob('*.{}'.format(extension))]

#combine all files in the list
combined_csv = pd.concat([pd.read_csv(f, sep = '|', dtype=str) for f in all_filenames ])
#export to csv
combined_csv.to_csv( "combined_csv.csv", sep='|', index=False, encoding='utf-8', line_terminator="\n", quoting=csv.QUOTE_ALL)