Skip to content

Instantly share code, notes, and snippets.

View damoxc's full-sized avatar

Damien Churchill damoxc

View GitHub Profile
@damoxc
damoxc / keybase.md
Created October 8, 2018 11:18
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:

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 July 28, 2014 18:39
A simple clock in Py3
#!/usr/bin/python3
import sys
import time
import datetime
BS_CHAR = '\u0008'
DATE_FMT = '%Y-%m-%d %H:%M:%S'
def clock():
#!/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 June 22, 2012 09:07
Naive BEAST vulnerability checker
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 November 18, 2011 01:12
Ip utilities module for Python
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 October 26, 2011 12:23
Module for reading Postfix queue files
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 September 22, 2011 13:08
Generate thumbnails and output media info
#!/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)
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)