This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from math import exp | |
from threading import Thread | |
import datetime | |
# example scrolling scene with inertial scrolling | |
# basic scrolling example was by Dalorbi on the forums at: | |
# http://omz-software.com/pythonista/forums/discussion/213/scrolling-in-scene-module/p1 | |
# inertial scrolling added on by hroe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- OCR all documents in a folder | |
-- | |
set theFolder to (choose folder with prompt "Choose Folder to OCR every PDF in") | |
ocr_this_folder(theFolder) | |
on ocr_pdf(PDFfilename) | |
tell application "PDFpenPro 6" | |
open PDFfilename | |
set theDoc to document 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- OCR all documents in a folder and all sub-folders | |
-- | |
set theFolder to (choose folder with prompt "Choose Folder to OCR every PDF in recursively descending") | |
ocr_this_folder(theFolder) | |
on ocr_pdf(PDFfilename) | |
tell application "PDFpenPro 6" | |
open PDFfilename | |
set theDoc to document 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install this file in: | |
# ~/Library/Application Scripts/com.smileonmymac.PDFpenPro6.MacAppStore/ | |
# and it will then be accessible from the Applescript menu in PDFpenPro 6 | |
tell application "PDFpenPro 6" | |
if (count documents) > 0 then | |
set myDoc to document 1 | |
set pageCount to count pages of myDoc | |
repeat with pageNumber from 1 to pageCount | |
if (height of page pageNumber of myDoc) > (width of page pageNumber of myDoc) then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
output="" | |
numDisplaySets=`/usr/libexec/PlistBuddy -c "Print DisplaySets" /Library/Preferences/com.apple.windowserver.plist | grep -E '^ Array' | wc -l` | |
for (( curDisplaySetNum=0; curDisplaySetNum<$numDisplaySets; curDisplaySetNum++ )) | |
do | |
echo "DisplaySet "$curDisplaySetNum | |
curDisplayNum=0 | |
notdone=1 | |
while [[ "$notdone" -ne 0 ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Copy and paste this script into a new document in AppleScript Editor. | |
When saving, select "Script Bundle" as File Type. | |
Save the file to: "~/Library/Script Libraries/Access NSScreen.scptd" | |
Note: you may need to create the directory: "~/Library/Script Libraries" | |
Note: while this gist has the file ending "scpt", by selecting the | |
"Script Bundle" file type, the file extension "scptd" should be added. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas | |
import numpy as np | |
awards = pandas.read_csv("awards_dump_2014-06-20.csv", | |
parse_dates=['StartDate', 'LastAmendmentDate', 'ExpirationDate', | |
'AwardedAmountToDate'], | |
converters={'AwardedAmountToDate': lambda x: | |
float(x.replace('$', '').replace(',', ''))}, | |
dtype={'AwardedAmountToDate':np.float64}) | |
awards['DurationYears'] = ((awards['ExpirationDate'] - awards['StartDate']) / | |
(365.25 * np.timedelta64(1, 'D'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
max_award_per_year = 3e5 # above this amount just bin in to top bin | |
years_per_bin = 1.0 | |
award_bin_size = 10000 | |
start_year = np.array([a.year + (a.month - 1)/12. for a in awards['StartDate']]) | |
year_bins = np.arange(np.floor(start_year.min()), np.ceil(start_year.max())+1, years_per_bin) | |
awarded_per_year = np.array(awards['AwardedAmountToDate']/awards['DurationYears']) | |
awarded_per_year_mean_per_bin = np.zeros(year_bins.size - 1) | |
awarded_per_year_median_per_bin = np.zeros(year_bins.size - 1) | |
year_per_bin = np.zeros(year_bins.size - 1) | |
for i in np.arange(year_bins.size - 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
max_award = 1e6 # above this amount just bin in to top bin | |
years_per_bin = 1.0 | |
award_bin_size = 50000 | |
start_year = np.array([a.year + (a.month - 1)/12. for a in awards['StartDate']]) | |
year_bins = np.arange(np.floor(start_year.min()), np.ceil(start_year.max())+1, years_per_bin) | |
awarded = np.array(awards['AwardedAmountToDate']) | |
awarded_mean_per_bin = np.zeros(year_bins.size - 1) | |
awarded_median_per_bin = np.zeros(year_bins.size - 1) | |
year_per_bin = np.zeros(year_bins.size - 1) | |
for i in np.arange(year_bins.size - 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
import matplotlib | |
matplotlib.use('WXAgg') | |
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas | |
from matplotlib.figure import Figure | |
from matplotlib.image import AxesImage | |
from matplotlib.axes import Axes | |
from matplotlib.widgets import AxesWidget | |
import matplotlib.pyplot as plt |
OlderNewer