Skip to content

Instantly share code, notes, and snippets.

#Copyright Timothy Clemans 2014 released under GPL
import os
import shutil
os.system('python gyb.py --email policevideorequests@gmail.com --search "to:kingcounty.gov OR from:kingcounty.gov"')
os.system('rm emails/*')
for dirpath, dirnames, filenames in os.walk("GYB-GMail-Backup-policevideorequests@gmail.com"):
for filename in filenames:
try:
shutil.copy(os.path.join(dirpath, filename), os.path.join('/root/got-your-back-0.29/emails/', filename))
except OSError:
# Copyright 2014 by Timothy Clemans released as free open source under GPL
"""You would setup an email address dedicated to this automated
requesting of GO reports.
(1) DONE: Computer code would download the GO Reports data from
https://data.seattle.gov/Public-Safety/Seattle-Police-Department-Police-Report-Incident/7ais-f98f
and extract the GO #s for types of incidents you care about in the
zones/beats for your zone.
(2) DONE: Computer would generate one request per report asking for the
report to be emailed in PDF format without exemption log as a reply to
# code is copyright Timothy Clemans released as free open source GPL
The Python code to redact every capitalized word and number and any sensitive words related to say SWAT team is:
import re
narrative = "This is a police narrative. This birthday 8/9/2014 will get redacted. This social security number 553-55-5555 will get redacted. This medication Xanax will get redacted."
words = narrative.split()
replacement_words = []
words_to_remove = ['robot']
for word in words:
#copyright 2014 timothyclemans GPL
#I'm using Windows. You need https://www.ffmpeg.org/download.html#build-windows and https://www.python.org/downloads/release/python-278/
#The directories need to be changed from the folder's on my girlfriend's laptop to those on the machine that will do the processing.
#This is the Python code:
import os
videos = [name for name in os.listdir("C:\Users\Christine\Desktop\over_redact\\") if name.endswith(".mp3")]
for video in videos:
This file has been truncated, but you can view the full file.
# copyright 2015 by timothy clemans released as free open source code under GPL
# this code marks which Go reports can be auto released and which need review/redaction
import os
import re
from datetime import datetime
from datetime import date
def calculate_age(born):
today = date.today()
# created by Tim Clemans and is open sourced under GPL
import os
import re
from datetime import datetime
from datetime import date
def calculate_age(born):
today = date.today()
try:
birthday = born.replace(year=today.year)
// This script is free open source code copyright by Timothy A. Clemans 2015 licensed under GPL
app.addToolButton({cName: "RedactGoReport", cLabel: "Redact Go Report", cEnable: "event.rc = (app.doc != null);", cExec: "redact(this);" });
var redact = app.trustedFunction( function(doc){
app.beginPriv();
var ssnRgExp = /\d{3}-\d{2}-\d{4}/; // regular expression for finding social security numbers
var redactionsMade = [];
var allTheWords = ''; // Save all the words so we can search for keywords that indicate whether or not redaction is required and whether or not
// there are attachments that need to be manually redacted
for (var page=0;page<doc.numPages;page++){
@policevideorequests
policevideorequests / gist:f127163338036e66e455
Created January 27, 2015 18:12
redact_go_report_for_website.js
// This script is free open source code copyright by Timothy A. Clemans 2015 licensed under GPL
app.addToolButton({cName: "RedactGoReportForWebsite", cLabel: "Redact Go Report for website", cEnable: "event.rc = (app.doc != null);", cExec: "redactForWebsite(this);" });
var redactForWebsite = app.trustedFunction( function(doc){
app.beginPriv();
var ssnRgExp = /\d{3}-\d{2}-\d{4}/; // regular expression for finding social security numbers
var redactionsMade = [];
var allTheWords = ''; // Save all the words so we can search for keywords that indicate whether or not redaction is required and whether or not
// there are attachments that need to be manually redacted
for (var page=0;page<doc.numPages;page++){
if 'XXXXX' in cols['body']:
cols['body'] = '*******Email content withheld due to my address being in the email********'
if 'password reset' in cols['Subject'].lower():
cols['body'] = '*******Email content withheld due to email containing link to reset password********'
if 'password:' in cols['body'].lower():
cols['body'] = '*******Email content withheld due to a password being in the email********'
if 'XXXX' in cols['body']:
cols['body'] = '*******Email content withheld due to my personal phone number being in the email********'
if 'XXXXXXXXXX@gmail.com' in cols['To'] or 'XXXXXXXXXXXXXXXXXXXX.org' in cols['To']:
cols['To'] = 'secret girlfriend'
import os
import re
os.system('rm *.pdf')
os.system('wget -nd -r -l 1 -A pdf http://www.seattle.gov/opa/closed-case-summaries')
files = sorted([f for f in os.listdir('.') if f.endswith('.pdf')])
for filename in files:
os.system('pdf2txt.py %s > %s' % (filename, filename[:-4]+'.txt'))
files = sorted([f for f in os.listdir('.') if f.endswith('.txt')])
opa_files = []
for filename in files: