Skip to content

Instantly share code, notes, and snippets.

Avatar

Damien Churchill damoxc

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am damoxc on github.
  • I am damoxc (https://keybase.io/damoxc) on keybase.
  • I have a public key whose fingerprint is 17FD 84EE A6B4 1534 7098 535D 88D5 3F7E 5132 BEF2

To claim this, I am signing this object:

View facter-openbsd-5.7
architecture => amd64
augeasversion => 1.3.0
domain => ***************
facterversion => 2.4.1
fqdn => ***************
gid => wheel
hardwareisa => amd64
hardwaremodel => amd64
hostname => ***************
id => root
@damoxc
damoxc / clock.py
Created Jul 28, 2014
A simple clock in Py3
View clock.py
#!/usr/bin/python3
import sys
import time
import datetime
BS_CHAR = '\u0008'
DATE_FMT = '%Y-%m-%d %H:%M:%S'
def clock():
View bcache-status
#!/usr/bin/env python3
#
# Dumb script to dump (some) of bcache status
# Copyright 2013 Darrick J. Wong. All rights reserved.
#
# This file is part of Bcache. Bcache 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@damoxc
damoxc / beast.py
Created Jun 22, 2012
Naive BEAST vulnerability checker
View beast.py
import ssl
import socket
import argparse
PASS = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
parser = argparse.ArgumentParser()
parser.add_argument('hostname', type=str, action='store')
@damoxc
damoxc / _ip.pyx
Created Nov 18, 2011
Ip utilities module for Python
View _ip.pyx
from libc.stdio cimport sprintf
from libc.string cimport strlen, strtok
def reverse_ip(ip):
cdef int ret
cdef char *_ip = ip, *p1, *p2, *p3, *p4, rip[16]
if strlen(_ip) > 15:
raise ValueError('Invalid IP address')
@damoxc
damoxc / _queue.pyx
Created Oct 26, 2011
Module for reading Postfix queue files
View _queue.pyx
from libc.stdio cimport FILE, fopen, fclose, fread, feof, ferror, fseek, SEEK_CUR, SEEK_SET, ftell, sscanf
from libc.string cimport memset, strlen, strtok
from cpython.mem cimport PyMem_Malloc, PyMem_Free
cdef extern from "ctype.h":
cdef int isascii (int c)
cdef int iscntrl (int c)
cdef extern from "sys/param.h":
cdef int NBBY
@damoxc
damoxc / create-thumbnails
Created Sep 22, 2011
Generate thumbnails and output media info
View create-thumbnails
#!/bin/bash
parse_time() {
IFS=' ' read -ra PART <<< "$1"
seconds=0
for i in "${PART[@]}"; do
number=$(expr match $i '\([0-9]\+\)')
unit=$(expr match $i '[0-9]*\([a-z]\+\)')
case $unit in
h)
View forking echo server using gevent
import os
import sys
import gevent
from gevent import socket
from gevent.server import StreamServer
acceptor = socket.socket()
acceptor.bind(('localhost', 4242))
acceptor.listen(10)