Skip to content

Instantly share code, notes, and snippets.

View seansawyer's full-sized avatar

Sean Sawyer seansawyer

View GitHub Profile
@seansawyer
seansawyer / README.md
Last active August 25, 2022 14:49
Managing OpenStack instances with Ansible through an SSH bastion host

Managing OpenStack instances with Ansible through an SSH bastion host

I'm be using DreamCompute as my OpenStack provider, but there are dozens to choose from. I assume you already have Ansible and the OpenStack CLI tools installed.

Motivation

With the proliferation of OpenStack public clouds offering free and intro tiers, it's becoming very easy to effectively run a simple application for free or nearly free. Also with the emergence of Ansible, you don't need to learn and deploy complicated tools to do configuration management.

@seansawyer
seansawyer / maze.py
Created September 18, 2021 11:52
Generate a maze using Kruskal's algorithm
import copy
import random
from typing import NamedTuple, FrozenSet
maze_height = 24
maze_width = 48
map_height = 50
map_width = 80
@seansawyer
seansawyer / vim-eclim-scala.md
Last active May 26, 2021 02:58
Vim + Eclim for Scala development

Vim + Eclim + Scala

WARNING! Do not install anything from update sites before installing Eclim! This is because Eclim determines available project natures (android, scala, etc) by trying to discover them at install time. If they are installed on a per-user basis, it won't find them. If you're installing Eclim for use with an existing Eclipse install

You're also better off not to install any plugins via your package manager. Eclim will give you the option to install plugins associated with each project nature from its install wizard.

Install Eclipse Luna. On Arch Linux, it's available in extra.

pacman -Sy eclipse

@seansawyer
seansawyer / map-touchup.html
Last active April 16, 2020 14:06
Touch up a blocky map to make it nicely drawable with line/junction tiles
<html>
<body>
<script>
var map = [
['#', '#', '#' ,'#', '#', '#' ,'#', '#', '#', '#'],
['#', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#'],
['#', ' ', ' ', '#', '#', ' ', ' ', ' ', ' ', '#'],
['#', '#', '#', '#', '#', ' ', ' ', ' ', ' ', '#'],
['#', ' ', '#', ' ', '#', '#', '#', '#', '#', '#'],
['#', ' ', '#', ' ', '#', ' ', ' ', ' ', ' ', '#'],
@seansawyer
seansawyer / graphics_boilerplate.py
Last active March 8, 2020 15:34
Roguelike Development in Python
import tcod
import tcod.event
tcod.console_set_custom_font(
'arial10x10.png',
tcod.FONT_LAYOUT_TCOD | tcod.FONT_TYPE_GREYSCALE,
)
with tcod.console_init_root(
CONSOLE_WIDTH,
@seansawyer
seansawyer / fsm-game-skeleton.py
Last active January 16, 2020 16:19
Boilerplate for a roguelike implemented as an FSM using libtcod
from dataclasses import dataclass
from enum import Enum
from typing import Callable, Dict, Optional, Tuple
import tcod
import tcod.event
@dataclass
class Game:
@seansawyer
seansawyer / reviewers.py
Created October 15, 2018 14:02
Randomly choose some teammates for code review, etc.
"""Randomly choose a list of teammates for code review, etc."""
from argparse import ArgumentParser
from getpass import getuser
from itertools import combinations
from random import randint
parser = ArgumentParser(description=__doc__)
parser.add_argument('--email',
@seansawyer
seansawyer / README.md
Last active May 2, 2018 14:27
A Brief History of Algorithmic Composition

A Brief History of Algorithmic Composition

One of the most often cited examples of algorithmic music in the Classical Period (1750-1827) is Musikalisches Würfelspiel by Wolfgang Amadeus Mozart (1756-1791). In this composition, Mozart composed discrete musical excerpts that could be combined to form a waltz. The order of musical excerpts was determined by rolling two six-sided dice. The person assembling the waltz would refer to a table created by Mozart that showed which music should be used for the values of 2-12 on the dice.

Works

After Wagner, there was pretty much nothing new that could be done with tonal composition. So music hipsters everywhere were distraught, and looking for a way to push composition and music theory in general forward. The answer came from Arnold Schoenberg and his followers in the early 20th century in the form of serial composition. Serial composition introduced a set of rules for composition that arguably served to birth algorithmic composition as we know it today.

Ly

@seansawyer
seansawyer / ocvpn
Created April 17, 2015 19:08
OpenConnect VPN script
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <dwmw2@infradead.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@seansawyer
seansawyer / script.md
Last active February 22, 2017 16:41
Retrospective: Laurie Anderson

Retrospective: The Music and Stories of Laurie Anderson

Spotify playlist

Good morning everyone, Sean here. Welcome to Retrospective.

Today we're going to wander through the work of not only a great musician, but also a great storyteller, and in my opinion one of the great American poets: Laurie Anderson.