Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig P Hicks craigphicks

View GitHub Profile
@craigphicks
craigphicks / mgmail.sh
Created Apr 13, 2018
Mail Gun API shell script for sending mail
View mgmail.sh
#!/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"
View MD of file being parsed - hexojs hexo issues 3178
---
title: Installing HEXO
tags:
- Software
categories:
- Hexo
comments: true
date: 2018-05-14 00:00:00
---
@craigphicks
craigphicks / sendmail-mailgun.py
Last active Jul 13, 2018
python 40 line drop-in replacement for sendmail/postfix etc - avoid setting files when only using mail to send system notifications to fixed address
View sendmail-mailgun.py
#!/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"
@craigphicks
craigphicks / sendmail-free-mailgun.sh
Last active Jul 13, 2018
Replace "sendmail" with (a link to) the script, and forward all system mails via free Mailgun acct to your chosen external address
View sendmail-free-mailgun.sh
#!/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
View passwordsafe-resources-formatv3.txt
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 / clip.md
Created Mar 2, 2019
A piece of md with nested <details> blocks that wond parse with markdown.extra or pymdownx.extra
View clip.md
## Full example with *lighttpd v1.4.45* and *Firefox v65.0*
@craigphicks
craigphicks / multi os booting with systemd-boot.md
Last active Mar 6, 2019
multi os booting with `systemd-boot` / `boot-ctl` --- case examples: LVM, LUKS with LVM, on SSD
View multi os booting with systemd-boot.md

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 Mar 10, 2019
Read a yaml conf file with markdown extensions and use that to format python-markdown command line
View call-pymd.py
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"
@craigphicks
craigphicks / secure-ssh-copy-to-remote-server.md
Last active Mar 12, 2019
How to send data to local clipboard from a remote SSH session
View secure-ssh-copy-to-remote-server.md

secure ssh copy to remote server

motivation

From machine A, user-A does an sshinto th eaccount user-B on server B for a terminal session.
In the course of that session, it would be convenient to copy some data to A's clipboard, without using mouse to drag and click. Example use cases:

  1. cat files content into local clipboard. C.f., cat <file> | xsel -i -b or cat <file> | xclip -i -selection b
@craigphicks
craigphicks / privca.sh
Last active Mar 13, 2019
Create private CA and server/client certs for 2-way auth secure closed networks. See https://github.com/craigphicks/privca
View privca.sh
#!/bin/bash
#
# craigphicks copyright 2019 - MIT license
# see https://github.com/craigphicks/privca
set -u
Existing_CA_CN=""
function _get_CA_CN {
You can’t perform that action at this time.