Skip to content

Instantly share code, notes, and snippets.

View dotysan's full-sized avatar

Curtis Doty dotysan

View GitHub Profile
@dotysan
dotysan / pyvenvex.py
Last active October 9, 2021 03:31 — forked from vsajip/pyvenvex.py
#
# Copyright (C) 2013 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
#! /usr/bin/env bash
#
# purpose: fork an already-cloned github repository from shell
#
# itch: You've made changes to someone else's repo that you've already
# cloned. Now you want to share them to github; but without all the
# silly gyrations.
#
# bug: it assumes you use ssh not https; and it creates/caches an api key
#
@dotysan
dotysan / spamhaus2quagga.sh
Last active June 17, 2020 05:52
Run as hourly cronjob to sync the Spamhaus DROP/EDROP lists into quagga.
#! /bin/bash -e
#
# maintain spamhaus blacklists as quagga prefix filters
#
cd ~/net
wget -nv -N http://www.spamhaus.org/drop/{,e}drop.txt
re1='^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+) '
re2='^([-+])([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+)$'
@dotysan
dotysan / arin-rpki-roagen.sh
Last active May 24, 2018 16:23
How to create your keypair and ROAs.
#! /bin/bash -e
#
# notes on setting up RPKI hosted on ARIN
#
umask u=rwx,g=rx,o=
keys=ARIN-RPKI-keypair.pem
pubkey=ARIN-RPKI-pubkey.pem
hash openssl
@dotysan
dotysan / get-github-user-info.js
Created March 29, 2014 22:05
newbie exercise with PhantomJS and web scraping
#! /bin/env phantomjs
/*
Teaching myself:
- [hopefully] clean/readable JavaScript coding
- PhantomJS to render a page from command-line
- using CSS selector to scrape an element value from DOM
*/
var SYS= require('system');
if(SYS.args.length <2) {
#! /bin/bash -ex
#
# crib notes on how to bootstrap midnight commander single-user
#
lf=libffi-3.1
gl=glib-2.43.0
sl=slang-2.3.0
mc=mc-4.8.13
@dotysan
dotysan / lacp.tcl
Created June 30, 2015 20:36
snippet to lean LACP members
# also fill an array with port-channel members so we can exclude them
set LACP [list]
if {$showLACP =="" && $tcl_platform(machine) =="Switch"} {
foreach word [split [exec "show etherc summ | begin ^\[0-9]"]] {
if [string is integer -strict $word] {
set portchannel $word
}
if [regexp {(.*)\(P\)$} $word -> lacp] {
lappend LACP $lacp
} } }
@dotysan
dotysan / remote-headless-brew.md
Last active April 18, 2017 00:26
Remotely install Homebrew over ssh.
#! /bin/bash -ex
#
# reminder/notes on how to remotely install NX over ssh
#
#there=${1-bonehead@192.0.2.1}
#ssh $there
cd ~/Downloads
# assuming this the latest version?
@dotysan
dotysan / mkcrypt.sh
Created June 17, 2016 20:25
Cheap attempt to generate a random password and its crypt-pw using mostly bash.
#! /bin/bash -e
#
# Cheap attempt to generate a random password and its crypt-pw using mostly bash.
#
SALT="./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
mkapass() {
local len=${1-8}
while [ ${n:=1} -le $len ]