Skip to content

Instantly share code, notes, and snippets.

View joedougherty's full-sized avatar

Joe Dougherty joedougherty

View GitHub Profile
@joedougherty
joedougherty / hyserver.py
Last active August 29, 2015 14:24
Porting @alienoid's WSGI server code to Hy! Source: http://ruslanspivak.com/lsbaws-part1/
(import socket)
(import [collections [namedtuple]])
(setv bindparams (namedtuple "bindparams" ["host" "port"]))
(setv bp (bindparams "" 8888))
(setv listen_socket (socket.socket socket.AF_INET socket.SOCK_STREAM))
(listen_socket.setsockopt socket.SOL_SOCKET socket.SO_REUSEADDR 1)
(listen_socket.bind bp)
(listen_socket.listen 1)
@joedougherty
joedougherty / display-ssh-key-ids.py
Created August 26, 2015 17:38
Convert bash script into Python for cross-platform running
import tempfile, os, subprocess
if not 'DO_API_TOKEN' in os.environ:
print("DigitalOcean API token not found. Export DO_API_TOKEN.")
exit(1)
with tempfile.NamedTemporaryFile() as fp:
fp.write("localhost ansible_connection=local")
invocation = "ansible localhost -i {tmpfile} -m digital_ocean -a".format(tmpfile=fp.name).split(' ')
invocation.append('command=ssh list_keys=true')
@joedougherty
joedougherty / create-vpn-with-sudo.log
Created August 27, 2015 18:12
Log of ./create-vpn with explicit sudo
PLAY [create vpn server] ******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [create-droplet | ensure dopy is installed (for digitalocean API)] ******
ok: [localhost]
TASK: [create-droplet | create digitalocean droplet] **************************
ok: [localhost]
@joedougherty
joedougherty / nmcli-missing.log
Created September 5, 2015 04:46
playbook run log 2015-05-15
PLAY [create vpn server] ******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [create-droplet | ensure dopy is installed (for digitalocean API)] ******
ok: [localhost]
TASK: [create-droplet | create digitalocean droplet] **************************
ok: [localhost]
@joedougherty
joedougherty / run.log
Created September 26, 2015 16:31
create-vpn-log-2015-09-26_12:30:28
joe@nor ~/ansible-digitalocean-vpn $ ./create-vpn
PLAY [create vpn server] ******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [create-droplet | ensure dopy is installed (for digitalocean API)] ******
ok: [localhost]
@joedougherty
joedougherty / post-openvpn-install.log
Created September 26, 2015 17:15
create-vpn-log-2015-2015-09-26_13:15:03
PLAY [create vpn server] ******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [create-droplet | ensure dopy is installed (for digitalocean API)] ******
ok: [localhost]
TASK: [create-droplet | create digitalocean droplet] **************************
ok: [localhost]
@joedougherty
joedougherty / vpn_autoconfigure_true.log
Created September 26, 2015 17:51
create-vpn-log-2015-09-26_13:50:59
PLAY [create vpn server] ******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [create-droplet | ensure dopy is installed (for digitalocean API)] ******
ok: [localhost]
TASK: [create-droplet | create digitalocean droplet] **************************
ok: [localhost]
@joedougherty
joedougherty / config_client_updated_with_items.log
Created September 26, 2015 18:21
create-vpn-log-2015-09-26_14:19:26
PLAY [create vpn server] ******************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [create-droplet | ensure dopy is installed (for digitalocean API)] ******
ok: [localhost]
TASK: [create-droplet | create digitalocean droplet] **************************
ok: [localhost]
class Adapter:
def __init__(self, object, **adapted_method):
self.object = object
self.__dict__.update(adapted_method)
def __getattr__(self, attr):
return getattr(self.object, attr)
@joedougherty
joedougherty / supervisord_vs_monit.txt
Last active October 31, 2017 16:06
supervisord_vs_monit
supervisord [supervisord.org]
=============================
* Set up jobs via a config file (.ini style)
Example:
--------
[program:forever]
command=/usr/bin/python /root/supervisoreval/bin/forever.py &
numprocs=1