Skip to content

Instantly share code, notes, and snippets.

View paul-schwendenman's full-sized avatar

Paul Schwendenman paul-schwendenman

View GitHub Profile
@paul-schwendenman
paul-schwendenman / kippo
Last active August 29, 2015 13:59
Setting up Kippo
#!/bin/bash
# /etc/init.d/kippo
### BEGIN INIT INFO
# Provides: kippo
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
@paul-schwendenman
paul-schwendenman / perfect_number.py
Created February 19, 2015 04:23
Perfect number
upper_bound = int(input("Upper bound: "))
n = 1
while n <= upper_bound:
factors = []
i = 1
while i < n:
if n % i == 0:
factors.append(i)
i += 1
@paul-schwendenman
paul-schwendenman / roman.py
Created February 23, 2015 04:47
Roman Numerals
order = 'MDCLXVI'
add_to_sub = (
('VIIII', 'IX'),
('LXXXX', 'XC'),
('DCCCC', 'CM'),
('IIII', 'IV'),
('XXXX', 'XL'),
('CCCC', 'CD'),
)
@paul-schwendenman
paul-schwendenman / file_tracker.py
Last active August 29, 2015 14:16
File tracker
import os
import json
import getpass
import pprint
pathMac = [
'/Applications/', os.path.join('/Users/', getpass.getuser(), 'Documents/'),
#os.path.join('/home/', getpass.getuser(), 'Downloads/'),
#os.path.join('/home/', getpass.getuser(), 'Documents/'),
]
#!/bin/sh
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
@paul-schwendenman
paul-schwendenman / .coveragerc
Created August 16, 2015 15:31
Sample coveragerc
[report]
exclude_lines =
pragma: no cover
if __name__ == .__main__.:
@paul-schwendenman
paul-schwendenman / fingerprint.py
Created August 21, 2015 15:27
Image Fingerprinting project
'''Tool for analyzing images'''
from __future__ import print_function
from PIL import Image
import imagehash
import argparse
import shelve
import glob
import glob2
import uuid
import random
@paul-schwendenman
paul-schwendenman / instructions.rst
Last active September 21, 2015 22:04
Ideas for installing sphinx

Installing

Add the universe repository:

sudo cp -p /etc/apt/sources.list /etc/apt/sources.list_backup
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
sudo apt-get update

Install python virtual environment:

@paul-schwendenman
paul-schwendenman / reverse-proxy.py
Created May 23, 2013 18:00
A very simple twisted server to provide a reverse proxy
"""
This example demonstrates a reverse proxy.
Run this example with:
$ python reverse-proxy.py
Then visit http://192.168.4.13:8000/ (or http://LISTEN_IP:LISTEN_PORT) in
your web browser.
"""
@paul-schwendenman
paul-schwendenman / settings.py
Last active December 18, 2015 16:58
A sample logging setup for django
SITE_ROOT = '/your/path'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},