Skip to content

Instantly share code, notes, and snippets.

View AABoyles's full-sized avatar

Tony Boyles AABoyles

View GitHub Profile
@AABoyles
AABoyles / ocr
Last active March 8, 2016 13:52
scripts
#!/usr/bin/env bash
# Dependencies: tesseract-ocr imagemagick scrot xsel
SCR_IMG=`mktemp`
trap "rm $SCR_IMG*" EXIT
scrot -s $SCR_IMG.png
mogrify -modulate 100,0 -resize 400% $SCR_IMG.png #should increase detection rate
tesseract $SCR_IMG.png $SCR_IMG &> /dev/null
cat $SCR_IMG.txt | xsel -bi
import random
exclusive = 0
def bad(thing_name, chance):
x = random.random()
if x < chance:
print (thing_name)
if thing_name in ("The person is in prison", "The person is on probation", "The person is in a nursing home", "The person is unemployed"):
exclusive = 1
@AABoyles
AABoyles / ocr.sh
Created October 23, 2015 19:49
Run this, select a screen region with some un-copyable text, and paste it like normal text.
#!/bin/bash
# Dependencies: tesseract-ocr imagemagick scrot xsel
SCR_IMG=`mktemp`
trap "rm $SCR_IMG*" EXIT
scrot -s $SCR_IMG.png
mogrify -modulate 100,0 -resize 400% $SCR_IMG.png #should increase detection rate
tesseract $SCR_IMG.png $SCR_IMG &> /dev/null
cat $SCR_IMG.txt | xsel -bi
@AABoyles
AABoyles / Resume.md
Created October 15, 2015 17:04
My Resume. In Markdown.

Anthony A. Boyles

Contact

Anthony@Boyles.cc (617) 935-5515 AABoyles.com

Work Experience

@AABoyles
AABoyles / bootstrap.sh
Last active May 9, 2018 14:34
Bootstrap a Ubuntu Machine
#!/usr/bin/env bash
## Deprecated. See instead: https://github.com/AABoyles/dotfiles/blob/master/bootstrap.sh
## Make sure we get the latest stable release of R.
echo 'deb https://cran.rstudio.com/bin/linux/ubuntu xenial/' >> /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
@AABoyles
AABoyles / creds.R
Created April 13, 2015 18:23
Credentials to connect to postgresql
library("RPostgreSQL")
con <- dbConnect(dbDriver("PostgreSQL"),
host="your database's host",
port="5432",
user="your database's username",
password="your database's password",
dbname="your database's name")
@AABoyles
AABoyles / icewsWeekdays.R
Created April 8, 2015 14:36
Event Distribution over Weekdays in ICEWS
if(!require("devtools")){
install.packages("devtools")
library("devtools")
}
install_github("aaboyles/phoxy")
library("phoxy")
library("data.table")
library("lubridate")
library("ggplot2")
@AABoyles
AABoyles / files.txt
Last active August 29, 2015 14:17
Text Mining in Python
AIED.2012.ch1.pdf
AIED.2012.ch2.pdf
AIED.2012.ch3.pdf
AIED.Appendix1.pdf
AIED.C1.pdf
AIED.C2.pdf
AIED.C3.pdf
AIED.C4.pdf
AIED.C5.pdf
AIED.C6.pdf
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
* @param string $orderby SQL ORDER BY constraint *OPTIONAL*
@AABoyles
AABoyles / LoveOverTime.R
Created February 13, 2015 15:32
Valentine's Analysis
library(ggplot2)
data <- data.frame(
Time=1:20,
Love=cumsum(abs(rnorm(20, sd = 5)*100)))
ggplot(data,aes(Time,Love)) +
stat_smooth(se=FALSE, aes(color="Red", size=3)) +
theme(legend.position = "none",
axis.text.x = element_blank(),