Skip to content

Instantly share code, notes, and snippets.

View jamesdmorgan's full-sized avatar

James Morgan jamesdmorgan

  • London
View GitHub Profile
@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@egidijus
egidijus / get-role-token
Last active January 12, 2017 14:55 — forked from cmerrick/get-role-token
Prints the exports required to install an AWS Role's temporary keys to stdout
#!/usr/bin/env python
import socket
import json
import sys
import os
import re
from subprocess import Popen, PIPE
from pprint import pprint
@nathanleclaire
nathanleclaire / bootstrap-multihost.sh
Last active September 27, 2020 17:56
Script to bootstrap multihost swarm with Docker Machine (DIGITALOCEAN_ACCESS_TOKEN env var must be set, and experimental client binary available as dockerx locally)
#!/bin/bash
set -e
# Create this many swarm workers
export N_WORKERS=1
# Coloring info
export bold=$(tput bold)
export normal=$(tput sgr0)
@mingfang
mingfang / convert id_rsa to pem
Last active March 3, 2024 08:46
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 600 id_rsa.pem
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
if field in res.keys():
encoded_field = res[field].encode('utf-8')
print '\n{0}:\n{1}'.format(field, encoded_field)
@tyrells
tyrells / disable-service.yml
Last active October 19, 2023 20:53
Ansible task to stop service even if it doesn't exist
# This task will stop and disable a service without failing if the service does not exist.
# Requires Ansible 1.4 or newer.
# Update Dec 2016: Have rewritten this for the latest version of ansible and put conditions for both Ubuntu and CentOS
- name: "disable unused services"
service: name={{item}} state=stopped enabled=no
register: command_result
failed_when: "unused_disable|failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)"
with_items:
@tomster
tomster / gist:7585211
Last active July 5, 2018 09:16
bootstrap a freebsd 9.2 host with ansible. it requires a password for the root user to be set for which it will prompt you (-k). you must use the paramiko transport to allow password based login. based on https://gist.github.com/illenseer/6390361
---
# run this with ansible-playbook -i ansible_hosts bootstrap.yml -k -c paramiko
- hosts: jails_host
gather_facts: false
remote_user: root
tasks:
- name: install pkgng
raw: "pkg_info | grep -v 'pkg-' > /dev/null ; if $? pkg_add -r pkg; rehash ; pkg2ng; echo 'WITH_PKGNG=yes' >> /etc/make.conf; echo 'packagesite: http://pkgbeta.freebsd.org/freebsd%3A9%3Ax86%3A64/latest' >> /usr/local/etc/pkg.conf; pkg update ; pkg upgrade -y"
- name: install python27
raw: "pkg install -y python27"
@dustinmm80
dustinmm80 / multivm_vagrant_dry.md
Created September 15, 2013 04:48
An example of how to write Vagrantfiles following the DRY principle.
=begin
Example box JSON schema
{
    :name => :name_of_vagrant_box, #REQUIRED
    :ip => '10.0.0.11', #REQUIRED
    :synced_folders => [
        { '.' => '/home/vagrant/myapp' }
    ],
    :commands => [
@nateware
nateware / haproxy.conf
Created October 31, 2012 15:36
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#