Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# Copyright 2011 (C) Daniel Richman
#
# This programme is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This programme is distributed in the hope that it will be useful,
@danielrichman
danielrichman / github_backup.py
Last active December 15, 2015 16:28
Backup public github repositories
#!/usr/bin/python
import sys
import os
import os.path
import re
from subprocess import check_call
# pip install PyGithub
from github import Github
@danielrichman
danielrichman / check_predictor.py
Last active October 8, 2015 10:18
Check that habhub.org/predict is working
#!/usr/bin/env python
# Copyright 2012 Daniel Richman. GNU GPL 3
# Logging setup borrowed from habitat.utils.startup
import time
import urllib
import json
import os
import logging
from logging.handlers import SMTPHandler
@danielrichman
danielrichman / build.sh
Created August 10, 2012 16:55
unused genpayload packing (wasn't worth the benefits)
#!/bin/sh
coffee --join js/genpayload.js --compile coffee/*.coffee &&
coffee --join js/specs.js --compile spec/*.coffee &&
python misc/make_test_docs.py &&
python misc/pack_files.py
@danielrichman
danielrichman / calendar.wsgi
Created June 30, 2012 22:26
habitat deployment misc
from habitat_calendar.cal import app as application
@danielrichman
danielrichman / couchdb_runviews.py
Created June 16, 2012 20:50
Refresh all couchdb views
#!/usr/bin/env python
# Copyright Daniel Richman 2012. License: GNU GPL 3
import sys
import couchdbkit
def main(uri, db):
server = couchdbkit.Server(uri)
database = server[db]
@danielrichman
danielrichman / raspi-d-i.md
Created May 30, 2012 15:47
raspi debian installer
Kernel

Prebuilt kernel & other files: http://drichman.net/files/raspi/d-i-disk.tar.gz Skip to Partitioning

Downlaods

sudo apt-get install gcc-4.6-arm-linux-gnueabi build-essential \
    libncurses-dev

sudo ln -s /usr/bin/arm-linux-gnueabi-gcc{-4.6,}

@danielrichman
danielrichman / deleted_libraries.py
Created May 3, 2012 20:04
cronjob to check for processes still using old (deleted) versions of dynamic libraries
#!/usr/bin/python
# Copyright 2012 Daniel Richman
import os
import os.path
import pwd
import traceback
def proc_maps():
for subdir in os.listdir("/proc"):
@danielrichman
danielrichman / linode_kernel_check.py
Last active October 4, 2015 03:37
Linode: check that the currently running kernel is up to date.
#!/usr/bin/python
# Copyright 2012 Daniel Richman.
# Protip: need not be run as root.
import sys
import os
import urllib2
import xml.dom.minidom
import traceback
@danielrichman
danielrichman / README.md
Created April 10, 2012 19:24
old habitat.habhub.org docs scripts

habitat.habhub.org miscellanea

The scripts here live and run on [[nessie.habhub.org]].

  • runas.c (compiles to runas): setugid CGI binary configured to be run by the web server whenever a certain url is fetched. This url is installed as a github post-receive hook. The setugid binary provides a secure way to go from running as www-data, to running as habitat-www in order to regenerate the sphinx documentation. Also locks a file to ensure that simultaneous updating isn't attempted.