Skip to content

Instantly share code, notes, and snippets.

View akaspin's full-sized avatar

Aleksandr Dorofeev akaspin

  • Remerge
  • Germany
View GitHub Profile
@Tenzer
Tenzer / README.md
Created February 18, 2015 21:20
Docker Registry S3 cleanup script

Docker Registry S3 cleanup script

This simply requires you to install the boto3 package and set the DOCKER_BUCKET variable to point at the bucket you would like to clean up, and the rest should be handled automatically. That's is presuming you have credentials to manage the S3 bucket in one of the default locations where Boto go to look for them.

Since the script more or less traverses through your entire S3 bucket, it probably makes sense to only run it infrequently, like daily or weekly, depending on the amount of repositories and layers you have and the amount of updates on the registry in total.

@sukrit007
sukrit007 / systemd-reload.service
Created February 6, 2015 01:00
Systemd Reload Hack for Fleet
[Unit]
Description=Systemd Reload Hack for coreos fleet
After=fleet.service
[Service]
Restart=always
RestartSec=20s
ExecStart=/bin/bash -c "while true; do if systemctl -all list-units | grep -e '@.*not-found.*inactive.*dead.*'; then systemctl daemon-reload; fi; systemctl -all list-units | grep '@[0-9].*loaded.*inactive.*dead.*' | awk '{print $1}' | xargs systemctl restart; sleep 120s; done"
@bketelsen
bketelsen / cloud-config.yaml
Last active November 27, 2018 10:08
Wait until ETCD Cluster is up and running before trying to do anything that might use ETCD
#cloud-config
---
write_files:
- path: /opt/bin/waiter.sh
owner: root
content: |
#! /usr/bin/bash
until curl http://127.0.0.1:4001/v2/machines; do sleep 2; done
coreos:
@turicas
turicas / virtualenv_execute.py
Created June 8, 2012 19:23
Execute Python code in a virtualenv, return its stdout and stderr
#!/usr/bin/env python
# coding: utf-8
import os
import shlex
from subprocess import Popen, PIPE
def execute_in_virtualenv(virtualenv_name, commands):
'''Execute Python code in a virtualenv, return its stdout and stderr.'''
@zaphar
zaphar / date_util.erl
Created May 1, 2009 06:07
set of utility functions that wrap the calendar module and erlangs now() date() and time() functions
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.