View extract_pdf_annotations_two.py
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdftypes import PDFObjectNotFound
import sys
def extract(objid, obj,pages,anno,marked):
if isinstance(obj, dict):
# 'Type' is PDFObjRef type
if obj.has_key('Type') and obj['Type'].name == 'Page':
pages.append(objid)
elif obj.has_key('C'):
View pypdf_sidebyside.py
from PyPDF2 import PdfFileWriter, PdfFileReader
import sys
in1,in2,out = sys.argv[1:]
output = PdfFileWriter()
input1 = PdfFileReader(file(in1, "rb"))
input2 = PdfFileReader(file(in2, "rb"))
m = min(input1.getNumPages(),input2.getNumPages())
View pypdf_addblank.py
from PyPDF2 import PdfFileWriter, PdfFileReader
import sys
in1,out = sys.argv[1:]
output = PdfFileWriter()
input1 = PdfFileReader(file(in1, "rb"))
for i in range(0,input1.getNumPages()):
p1 = input1.getPage(i)
View onlyimageslink.py
View youtube-dla.sh
#!/bin/bash
# get filename from youtube-dl then replace it with mp4
# then download, convert to mp4 and put metadata
filename=$(youtube-dl --get-filename "$1")
filename=${filename%.*}.mp4
youtube-dl "$1" --recode-video mp4 --add-metadata
exiftool $filename -XMP:source=$1
exiftool $filename
View treelisting.py
import argparse
import csv
import os
import uuid,json,subprocess
import zipfile
import time
# TODO crossplatform
# TODO given path extract volume then label+uuid+diskformat
#
# OSX: add path => volume using mount output
View hideincludes.sb
(version 1)
(deny default)
(allow sysctl-read)
(allow signal)
(allow process-exec)
(allow process-fork)
(allow mach* sysctl-read)
(allow file-read* (regex "^.*"))
(deny file-read* (regex "^/usr/local/include.*") (regex "^/usr/include.*"))
(allow file-write* (regex (string-append "^/tmp/.*")) (regex (string-append "^" (regex-quote (param "target")) ".*")) )
View gist:3a92f7badd5d0d76cc4e6a2cc35c6beb
OrderedDict([(x,x) for x in ["name"]+sorted(set(q.keys())-set(["name"]))])
tabulate.tabulate(z,headers="firstrow")
View lfsr1.py
#https://en.wikipedia.org/wiki/Linear-feedback_shift_register
from bitstring import BitArray
def pad(x,K):
N = len(x)
PAD = N % K
if PAD > 0:
PAD = K-PAD
# tell me better
x = x + BitArray(bin='0'*PAD)
View Makefile
outputs = Generic.pdf Architecture.pdf Hybrid.pdf ConsoleArch.pdf
all: ${outputs}
tmp.pdf: Images.pptx
osascript pptexport.applescript $(abspath $<) $(abspath tmp.pdf)
${outputs}: tmp.pdf