Skip to content

Instantly share code, notes, and snippets.

@mattvonrocketstein
mattvonrocketstein / krest.py
Created February 27, 2015 20:15
krest: A kule based, SSL enabled, read-only rest interface for a configuration management schema on top of MongoDB.
""" krest 0.22:
A kule based, SSL enabled, read-only rest interface for a configuration
management schema on top of MongoDB. The assumed layout for krest to
read configuration data is this: you must have a database called "config",
and inside "config", you have collections for each environment (i.e.
"prod", "test", and "dev"). Inside each collection, documents fit the
following schema:
{'app':app_name, 'config': <arbitrary configuration json> }
@mattvonrocketstein
mattvonrocketstein / fabfile.py
Created March 27, 2015 04:27
self-hosting fabfile
if __name__ == '__main__':
# a neat hack that makes this file a "self-hosting" fabfile,
# ie it is invoked directly but still gets all the fabric niceties
# like real option parsing, including --help and -l (for listing
# commands). note that as of fabric 1.10, the file for some reason
# needs to end in .py, despite what the documentation says. see:
# http://docs.fabfile.org/en/1.4.2/usage/fabfiles.html#fabfile-discovery
#
# the .index() manipulation below should make this work regardless of
# whether this is invoked from shell as "./foo.py" or "python foo.py"
@mattvonrocketstein
mattvonrocketstein / serv.py
Last active August 29, 2015 14:21
multithreaded directory server
#!/usr/bin/env python
import sys
import SocketServer
import BaseHTTPServer
import SimpleHTTPServer
class ThreadingSimpleServer(
SocketServer.ThreadingMixIn,
BaseHTTPServer.HTTPServer):
@mattvonrocketstein
mattvonrocketstein / dd_event.py
Last active August 29, 2015 14:22
a quick utility for writing events to the Datadog events stream
#!/usr/bin/env python
""" dd_event:
a quick utility for writing events to the Datadog events stream.
requires:
pip install dogapi
pip install argparse
"""
import argparse
@mattvonrocketstein
mattvonrocketstein / epydoc.css
Last active February 21, 2019 16:52
epydoc.css
/* Epydoc CSS Stylesheet
*
* This is a massivley hacked stylesheet for epydoc, the very nice Python API
* Documentation generator. The general look and feel is based on sphinx.
* https://raw.githubusercontent.com/garethr/epydoc-themes/master/epydoc.css
*
* Feel free to tweak this some more to make the theme even more pleasing
* if you have the time to spare for such things. The typography in particular
* could do with sorting out. Unless you like writing masocistic CSS however,
* I'd recommend looking to refactor the markup generated by epydoc.
@mattvonrocketstein
mattvonrocketstein / mkdocs.yml
Last active August 29, 2015 14:23
mkdocs.yml
site_name: Placeholder
theme: readable
repo_url: https://github.com/mattvonrocketstein/placeholder.git
site_author: mvr
pages:
- 'Main page': 'index.md'
- 'API Reference': 'api/index.html'
defmacro print(thing) do
if String.valid?(thing) do
quote bind_quoted: binding() do
IO.puts thing
end
else
quote bind_quoted: binding() do
IO.puts("#{inspect thing}")
end
end
@mattvonrocketstein
mattvonrocketstein / fabfile.py
Last active July 29, 2016 14:51
version_bump fabfile
# -*- coding: utf-8 -*-
import os
from fabric import api
from fabric import colors
from fabric.contrib.console import confirm
_ope = os.path.exists
_mkdir = os.mkdir
_expanduser = os.path.expanduser
_dirname = os.path.dirname
@mattvonrocketstein
mattvonrocketstein / fabfile.py
Last active July 29, 2016 15:57
vulture fabfile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import contextlib
from fabric import api
PKG_NAME = 'MY_PKG'
VULTURE_EXCLUDE_PATHS = ['tests', ]
VULTURE_IGNORE_FUNCTIONS = ['commandline_entry_point']
@mattvonrocketstein
mattvonrocketstein / fabfile.py
Last active August 3, 2016 08:24
release fabfile
# -*- coding: utf-8 -*-
import os
import sys
from fabric import api
from fabric import colors
from fabric.contrib.console import confirm
PKG_NAME = 'PKG_NAME'
THIS_DIR = os.path.dirname(os.path.abspath(__file__))