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 / passwd.sh
Last active August 29, 2015 14:06
Password Management with bash and ccrypt
#!/bin/bash
function getpass() {
if [[ -f $HOME/.passwd.cpt ]]; then
password=$(ccrypt -c $HOME/.passwd.cpt | egrep $1 | cut -f 3 -d ":")
else
password=$(egrep $1 $HOME/.passwd | cut -f 3 -d ":")
fi
if [[ $password == "" ]]; then
anonymous
anonymous / homeromsterbinpkg-not.txt
Created September 30, 2014 01:48
/home/romster/bin/pkg-not
#!/bin/bash
#
# Copyright (c) 2008 by Jose V Beneyto, sepen at users dot sourceforge dot net
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@prologic
prologic / prttest.sh
Created November 19, 2014 12:50
Rough idea of prttest
#!/bin/bash
PORT=$(dirname pwd)
cat - > Dockerfile <<EOF
FROM crux/base
VOLUME /usr/ports/contrib/test
RUN ports -u && prt-get cache
@prologic
prologic / getpass
Created February 22, 2015 22:14
created by github.com/tr3buchet/gister
#!/bin/bash
function getpass() {
if [[ -f $HOME/.passwd.cpt ]]; then
password=$(ccrypt -c $HOME/.passwd.cpt | egrep $1 | cut -f 3 -d ":")
else
password=$(egrep $1 $HOME/.passwd | cut -f 3 -d ":")
fi
if [[ $password == "" ]]; then
@prologic
prologic / restart_scaling_group.py
Last active August 29, 2015 14:20
Hacked up script to restart an AWS Auto-Scaling Group
#!/usr/bin/env python
import sys
from time import sleep
from functools import partial
import boto.ec2.autoscale
@prologic
prologic / udptcpbroadcast.py
Last active August 29, 2015 14:20
A UDP/TCP Broadcaster
#!/usr/bin/env python
from circuits.net.events import write
from circuits import handler, Component, Debugger
from circuits.net.sockets import TCPServer, UDPServer
class UDPTCPBroadcaster(Component):
@prologic
prologic / check-docker.json
Last active August 29, 2015 14:25
autodock based Docker Compose for Sensu monitoring
{
"checks": {
"load_docker_metrics": {
"type": "metric",
"command": "load-docker-metrics.sh",
"subscribers": [
"docker"
],
"interval": 10
}
@prologic
prologic / docker-compose.yml
Last active August 29, 2015 14:25
autodock based Docker Compose for Prometheus monitoring
autodock:
image: prologic/autodock
ports:
- "1338:1338/udp"
- "1338:1338/tcp"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: always
autodockhipache:
@prologic
prologic / Python6Unicode.md
Created August 25, 2015 01:49
Supporting Python 2/3 and Unicode

Python 2/3 Unicode

Basic Rules

  • Use six
  • Use six.u() everywhere you expose a Unicode/String API (anything that is meant for Humans!)
  • Use six.text_type() in place of unicode()
  • Implement the following "Python special methods":
@scardine
scardine / topojson.py
Created August 23, 2013 14:39
Experiments trying to implement topojson in Python using shapely.
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: