Skip to content

Instantly share code, notes, and snippets.

Craig P Hicks craigphicks

View GitHub Profile
@craigphicks
craigphicks / setup-openwrt-rpi3bplus-and-nftables.md
Last active Apr 23, 2019
Setting up openwrt to run on Paspberry Pi 3 B+ - and replacing `iptables` with `nftables`
View setup-openwrt-rpi3bplus-and-nftables.md
@craigphicks
craigphicks / iptree.py
Last active Apr 12, 2019
Convert `iptables -S` output to a depth-first tree listing
View iptree.py
#!/usr/bin/env python3
'''
Convert `iptables -S` output to a depth-first tree listing
Reads from standard input
Craig P Hicks 2019
MIT License
'''
import sys
@craigphicks
craigphicks / howto-ssh-pipe.md
Last active Apr 6, 2019
Set up an ssh pipe
View howto-ssh-pipe.md

Setting up a pipes between A and B

A to B (setup on A)

From A, set up a pipe for sending data from A to B

a@A: ssh -v -N -L 2223:127.0.0.1:2222 b@B

To test it, first open a listener on B

@craigphicks
craigphicks / script.py
Last active Mar 26, 2019
python3 Script to create instance of LDX container with debian stretch from linuxcontainers and configure it up to ssh-login-ability
View script.py
#!/usr/bin/env python3
import argparse
import textwrap
import subprocess
import os
import datetime
#import pdb
#import random
import time
@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 / 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 / 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 / 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 / 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 {
@craigphicks
craigphicks / make-cert.sh
Last active Feb 23, 2019
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
View make-cert.sh
#!/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}
You can’t perform that action at this time.