Skip to content

Instantly share code, notes, and snippets.

@craigphicks
craigphicks / mgmail.sh
Created April 13, 2018 01:06
Mail Gun API shell script for sending mail
#!/bin/bash
mgmail()
(
dflt_to="xxx@gmail.com"
dflt_froma="xxx@example.com"
dflt_sub="notice from admin"
dflt_text="default text"
mailgun_domain="example.com"
keyfile="./privatekey.txt"
---
title: Installing HEXO
tags:
- Software
categories:
- Hexo
comments: true
date: 2018-05-14 00:00:00
---
@craigphicks
craigphicks / sendmail-free-mailgun.sh
Last active July 13, 2018 23:43
Replace "sendmail" with (a link to) the script, and forward all system mails via free Mailgun acct to your chosen external address
#!/bin/bash
# Documentation can be found on either of following blogs (with mirrored content):
# https://pindertek.net/2018/07/04/sendmail-free-mailgun/
# https://craigphicks.github.io/2018/07/04/sendmail-free-mailgun/
# NOTE: root permission required to write to /var/log.
# Choose another log location if that will not be suitable.
Logfile=/var/log/sendmail-dummy.log
if [[ $EUID -ne 0 ]]; then
@craigphicks
craigphicks / sendmail-mailgun.py
Last active July 13, 2018 22:20
python 40 line drop-in replacement for sendmail/postfix etc - avoid setting files when only using mail to send system notifications to fixed address
#!/usr/bin/env python3
import os
import sys
import subprocess
s = ""
s += "---- begin args ----\n"
for i in range(0,len( sys.argv )):
s+= "argv[" + str(i) + "]:" + str(sys.argv[i]) +"\n"
PasswordSafe database format description version 3.31
-----------------------------------------------------
Copyright (c) 2003-2016 Rony Shapiro <ronys@pwsafe.org>.
All rights reserved. Use of the code is allowed under the Artistic
License terms, as specified in the LICENSE file distributed with this
code, or available from
http://www.opensource.org/licenses/artistic-license-2.0.php
@craigphicks
craigphicks / make-cert.sh
Last active October 26, 2019 01:34
self managed private CA and certs - no config files, two levels only, no intermediate, no revocation list, file names are CN - ideal for personal IoT
#!/bin/bash
# craigphicks 2019
set -u
function CreateCertificateAuthority {
if [[ $# -ne 2 ]] ; then
echo "two args only: CA common name, CA org name"
exit 1
fi
CA_CN=${1}
@craigphicks
craigphicks / privca.sh
Last active March 13, 2019 10:11
Create private CA and server/client certs for 2-way auth secure closed networks. See https://github.com/craigphicks/privca
#!/bin/bash
#
# craigphicks copyright 2019 - MIT license
# see https://github.com/craigphicks/privca
set -u
Existing_CA_CN=""
function _get_CA_CN {
@craigphicks
craigphicks / clip.md
Created March 2, 2019 10:47
A piece of md with nested <details> blocks that wond parse with markdown.extra or pymdownx.extra
## Full example with *lighttpd v1.4.45* and *Firefox v65.0*
@craigphicks
craigphicks / multi os booting with systemd-boot.md
Last active March 6, 2019 10:05
multi os booting with `systemd-boot` / `boot-ctl` --- case examples: LVM, LUKS with LVM, on SSD

multi os booting with systemd-boot

We set up multiple OS to be booted from a UBS SD.

Both are Ubuntu.

  • ub16 is on an LVM2 partition.
  • ub18 is on an encrypted LUKS partition with LVM2 on the inside. As it happen, the disk is SSD.

Formatting the USB SD

@craigphicks
craigphicks / call-pymd.py
Created March 10, 2019 00:40
Read a yaml conf file with markdown extensions and use that to format python-markdown command line
import yaml
#import pdb
import sys
import subprocess
import pprint
fn_mdin = "./mdext.yml"
fn_mdcfgtmp = "./tmp/mdext-CFG.yml"
fn_scr="./call-pymd.out"