Skip to content

Instantly share code, notes, and snippets.

View adam-stokes's full-sized avatar
🦧

Adam Stokes adam-stokes

🦧
  • North Carolina
  • 12:51 (UTC -04:00)
View GitHub Profile
@brianshumate
brianshumate / docker-macos-terraform.md
Last active April 16, 2024 02:18
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

#!/usr/bin/python3
#
# Copyright 2017 Canonical, Ltd. Authored by Marco Ceppi
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@sj26
sj26 / LICENSE.md
Last active March 8, 2024 18:31
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@evandandrea
evandandrea / .travis.sh
Last active January 23, 2021 14:56
Automatically publish to the snap store from Travis
#!/bin/sh -e
if [ -z "$SNAPCRAFT_SECRET" ]; then
# Run `sh seed.sh` on your local machine so SNAPCRAFT_SECRET is set.
exit 0
fi
mkdir -p ".encrypted"
if [ ! -e ".encrypted/snapcraft.cfg.enc" ]; then
echo "Seeding a new macaroon."
#!/bin/bash
set -eu
_UID=$(id -u)
GID=$(id -g)
# give lxd permission to map your user/group id through
grep root:$_UID:1 /etc/subuid -qs || sudo usermod --add-subuids ${_UID}-${_UID} --add-subgids ${GID}-${GID} root
# set up a separate key to make sure we can log in automatically via ssh
# with $HOME mounted
#!/usr/bin/env perl
# Copyright 2015 by David Golden
# Licensed under CC0 https://creativecommons.org/publicdomain/zero/1.0/
# Updated 2016-03-01:
# - more variation in organzations selected; you will want to customize this yourself
# - splits out wishlists differently/correctly
# - reports only PRs unless --all is specified
use v5.10;
use strict;
use warnings;
@adam-stokes
adam-stokes / padder.py
Created June 17, 2015 00:12
urwid padding decorator
from urwid import Padding as _Padding
from functools import partialmethod
def apply_padders(cls):
padding_count = 100
for i in range(1, padding_count):
setattr(cls, 'push_{}'.format(i), partialmethod(_Padding, left=i))
setattr(cls, 'pull_{}'.format(i), partialmethod(_Padding, right=i))
setattr(cls, 'center_{}'.format(i),
@beaugunderson
beaugunderson / cool-modules.md
Last active February 2, 2023 19:58
cool modules from nodeconf

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

@mikemccracken
mikemccracken / gist:a28381db3820a2000f23
Last active August 29, 2015 14:21
cleaning up loop mounted volume groups
create_vg() {
# loopback file for PV:
pvfile=$LXD_DIR/lvm-pv.img
fallocate -l 1GB $pvfile
pvloopdev=$(losetup -f)
losetup $pvloopdev $pvfile
#vgcreate will create a PV for us
vgcreate lxd_test_vg $pvloopdev
import haxe.Constraints.Function;
@:pythonImport("flask", "Flask")
extern class Flask {
function new(module:String);
function run():Void;
function route<T:Function>(path:String):T->T;
}
class Main {