Skip to content

Instantly share code, notes, and snippets.

View prologic's full-sized avatar
👋
Principal SRE, Founder of Yarn.social and Salty.im

James Mills prologic

👋
Principal SRE, Founder of Yarn.social and Salty.im
View GitHub Profile
@prologic
prologic / op_get_self.diff
Created March 20, 2019 10:30 — forked from mrnugget/op_get_self.diff
Fix for recursive closures that are defined in other functions. These break in version 1.0 of "Writing A Compiler In Go". This fix adds another opcode, OpGetSelf, and emits it whenever there's a reference to the currently executed function.
diff --git a/ast/ast.go b/ast/ast.go
index 8db3b39..f0420f4 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -2,6 +2,7 @@ package ast
import (
"bytes"
+ "fmt"
"strings"
@prologic
prologic / swarm-create
Created December 23, 2015 06:16 — forked from jorelcb/swarm-create
bash script to create docker swarm cluster with docker machine and virtualbox
#!/bin/bash
# Script para generar entorno simulado de cluster Swarm con 3 nodos
# Creación de maquina default (se utilizara como cliente )
# docker-machine create -d virtualbox default
# eval $(docker-machine env default)
# Lanzamos swarm desde maquina default
SWARM_TOKEN=$(docker run swarm create)
@prologic
prologic / pypi-release-checklist.md
Created December 23, 2015 06:06 — forked from audreyfeldroy/pypi-release-checklist.md
My PyPI Release Checklist
  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@prologic
prologic / index.js
Last active August 29, 2015 14:04 — forked from hsubra89/index.js
A simplistic port of circuits for Python to JavaScript / NodeJS
/**
* circuits Component Framework for JavaScript
*
* @module circuits
*/
var EventEmitter = require("events").EventEmitter,
EventManager;
"""
Tools for creating a CA cert and signed server certs.
Divined from http://svn.osafoundation.org/m2crypto/trunk/tests/test_x509.py
The mk_temporary_xxx calls return a NamedTemporaryFile with certs.
Usage ;
# Create a temporary CA cert and it's private key
cacert, cakey = mk_temporary_cacert()
@prologic
prologic / gist:8929120
Last active August 29, 2015 13:56 — forked from philips/gist:7555876

Add a local docker unit file

Create a file called /media/state/units/docker-local.service that has the following contents:

[Unit]
Description=docker local

[Service]
PermissionsStartOnly=true
from shapely.geometry import shape, Point, MultiPoint
import math
import json
def get_bounds(geometries):
"""Returns bounding box of geometries. Implementation creates a MultiPoint
from the boxes of all polygons in order to get the result"""
points = []
for g in geometries:
@prologic
prologic / pyproto.py
Created September 14, 2013 05:55 — forked from foxbunny/pyproto.py
""" https://bitbucket.org/brankovukelic/pyproto """
from copy import copy
__all__ = ['Object']
class Object(object):
"""Base prototype for prototypal object model in Python
To create a new object, simply instantiate an Object instance::