Skip to content

Instantly share code, notes, and snippets.

@evilabandon
evilabandon / daemon.py
Created April 2, 2013 04:52
A generic daemon class. daemon with apscheduler
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
@theorm
theorm / mongobak.py
Created August 29, 2013 05:54
Backup/Restore MongoDB collections or databases to/from S3
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import subprocess
import shutil
import tarfile
import tempfile
import argparse
@dreamcat4
dreamcat4 / cpu-speed
Created June 23, 2014 00:41
Get and set the max CPU frequency on FreeBSD / FreeNAS / NAS4Free
#!/bin/sh
#
# cpu-speed:
# Requirements - be the root user, FreeBSD 9.2 or higher.
#
# Get or set the CPU frequency. This command with no arguments will
# print the current CPU frequency. CPU may be idling at it's lowest speed.
#
# This command takes 1 optional argument - new MAX cpu freq (in Mhz).
# expressed as an integer number. e.g. "cpu 800" - set max freq 800 Mhz.