Skip to content

Instantly share code, notes, and snippets.

View philcryer's full-sized avatar
💭
Mostly harmless

Phil Cryer philcryer

💭
Mostly harmless
View GitHub Profile
@philcryer
philcryer / oicr
Created October 6, 2010 02:30
downloads a djvu file, splits it into pages (djvmcvt), parses out ocr'd text (djvused) and also creates an XML of the ocr'd text (djvutoxml)
#!/bin/bash
[[ -n "${1}" ]] || { echo "Usage: oicr.sh IA_BOOK_TITLE"; exit 0 ; }
# sample record ids: catalogueoflepid02briti electronicnaviga00unit halfhoursinfarno00newy nachrichtsblattd3234190012deut
BOOK=${1}
#BASEURL=http://cluster.biodiversitylibrary.org
BASEURL=http://www.archive.org/download
@philcryer
philcryer / bhldata_box.sh
Created October 13, 2010 20:15
Get latest bhl.zip, rename it with the date, generate an md5 of it, move those files into a Dropbox directory, get the public Dropbox URL for that file, create a HTML file containing a link to that, and put that URL and put that HTML in on a webserver.
#!/bin/bash
DATE=`date +%Y%m%d`
TARGET_PATH=/home/phil/Dropbox/Public
WWW_USER=www-data
WWW_GROUP=www-data
WWW_PATH=/var/www/data
if [ ! -d ${WWW_PATH} ]; then
mkdir -p ${WWW_PATH}
chown -R ${WWW_USER}:${WWW_GROUP} ${WWW_PATH}
@philcryer
philcryer / rrunner.sh
Created December 1, 2010 19:38
run an R script in the current directory, capture start/end time, set perms for www view
#!/bin/bash
# run R script in the current directory, capture start/end time, set perms for www view
# loop for a number of times, default 20, and then end.
if [ "$1" == "" ]; then
echo " [ FAILED ] need an R script name"
exit 1
else
echo " [ OK ] R script name given"
@philcryer
philcryer / macfind
Created January 4, 2011 05:58
define a network card manufacturer from a given MAC address
#!/bin/bash
EXPECTED_ARGS=1
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` MAC_ADDRESS"
exit 1
fi
@philcryer
philcryer / indigestion.sh
Created February 23, 2011 22:28
brings in IA-style metadata into fedora-commons, for great justice!
#!/bin/bash
###############
# about
###############
# bring in IA-like data, from TITLE_ID.files.xml
###############
# variables
@philcryer
philcryer / chromium_mac_updater.sh
Created February 25, 2011 14:59
download, unzip and install the latest Chromium (Google Chrome Dev build) on OS X
#!/bin/bash
# Distributed under the terms of the BSD License
# Copyright (c) 2011 Phil Cryer phil.cryer@gmail.com
# http://gist.github.com/843896
# download, unzip and install the latest Chromium (Google Chrome Dev build) on OS X
# NOTICE: absolutely no returns without a receipt! No exceptions!
# is there a directory in tmp to do this? if not, make it
if [ ! -d '/tmp/chromedownload' ]; then
@philcryer
philcryer / oicr.sh
Created February 25, 2011 16:00
a basic starting point to get IA styled content in djvu form, break them up into pages to get them ready for re-OCR'ing them. you need djvu tools (djvulibre-bin in debian/ubuntu)
#!/bin/bash
[[ -n "$1" ]] || { echo "Usage: oicr.sh IA_BOOK_TITLE"; exit 0 ; }
# sample record ids: catalogueoflepid02briti electronicnaviga00unit halfhoursinfarno00newy nachrichtsblattd3234190012deut
BOOK=$1
BASEURL=http://cluster.biodiversitylibrary.org/n
#BASEURL=http://www.archive.org/download
@philcryer
philcryer / meego-bc-installer.sh
Created May 20, 2011 02:47
Install Broadcom Wifi driver on Dell Mini9 in Meego 1.2
#!/bin/bash
# MEEGO 1.2 WIFI
# install Broadcom Wifi driver on Dell Mini9 in Meego 1.2
# created from http://slaine.org/_slaine/Meego_1.2_Wifi.html
# thanks slaine.org
sudo zypper update
sudo zypper install rpmdevtools
sudo zypper install pattern:meego-development-tools
@philcryer
philcryer / logstash.sh
Created December 24, 2011 02:50
a basic init.d script for Logstash
#! /bin/sh
#
# Logstash Start/Stop logstash
#
# chkconfig: 345 99 99
# description: Logstash
# processname: logstash
logstash_bin="/usr/bin/java -jar /opt/logstash/logstash-1.0.17-monolithic.jar"
logstash_conf="/etc/logstash/shipper.conf"
@philcryer
philcryer / grabby.sh
Created April 10, 2012 15:56
a bash script to perform batch downloads of Internet Archive (archive.org) materials, via record ids as listed in todo.txt
!/bin/bash
#
################################################################################
#
# File : grabby.sh
# Usage : ./grabby.sh
# Author : phil.cryer@mobot.org
# Date created : 2009-10-10
# Last updated : 2012-04-10
# Source : http://code.google.com/p/bhl-bits/utilities/grabby