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 / 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/'),
]
@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 / 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 / cee_lo.py
Last active November 11, 2020 20:03 — forked from anonymous/Cee-Lo
Cee Lo dice game
'''
Cee-lo is a gambling game played with three six-sided dice.
'''
from __future__ import print_function
import random
from collections import Counter
def input_float(msg):
'''

Allow incoming:

iptables -A INPUT  -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type 0 -m state --state ESTABLISHED,RELATED -j ACCEPT

Allow outgoing:

iptables -A OUTPUT -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT  -p icmp --icmp-type 0 -m state --state ESTABLISHED,RELATED -j ACCEPT
@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 / gpg.rst
Last active July 30, 2018 14:09
GPG Cheatsheet

GPG Cheat sheet

A small guide to little things

Create a key

@paul-schwendenman
paul-schwendenman / digocean.py
Last active July 6, 2016 08:01
Digital Ocean API wrapper
#! /usr/bin/env python
import digitalocean
import time
import os
import sys
try:
token = os.environ["DIGO_TOKEN"]
except KeyError:
@paul-schwendenman
paul-schwendenman / ldap.rst
Last active December 31, 2015 01:09
LDAP for Django

Introduction

This document will include the author's entire notes on installing and configuring ldap for django.

Installation

  1. Create a directory in /opt:
@paul-schwendenman
paul-schwendenman / gunicorn
Last active June 5, 2024 02:36
Gunicorn setup
#!/bin/bash
# /etc/init.d/gunicorn
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5