Skip to content

Instantly share code, notes, and snippets.

@dukelion
dukelion / mysql_copy.py
Last active August 29, 2015 14:22
A script for mysql database quick-and dirty cloning
#!/usr/bin/python
import sys, argparse
import mysql.connector
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument("--target", required=True, help="Target db name")
parser.add_argument("--template", default="template", help="Source template db name")
args = parser.parse_args()
@dukelion
dukelion / import-cert.sh
Last active August 29, 2015 14:17
import self-signed https to chrome
#!/bin/sh
#
# usage: import-cert remote.host.name [port]
#
REMHOST=$(echo $1 | sed -re 's@http(s)?://([^/]*).*@\2@')
REMPORT=${2:-443}
exec 6>&1
exec > $REMHOST
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "$REMHOST" -i $REMHOST
# No-IP automatic Dynamic DNS update
#--------------- Change Values in this section to match your setup ------------------
# No-IP User account info
:local noipuser "login"
:local noippass "password"
# Set the hostname or label of network to be updated.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.