Skip to content

Instantly share code, notes, and snippets.

View mnyrop's full-sized avatar
🥶
ice guy

marii¨ mnyrop

🥶
ice guy
View GitHub Profile

Prod specs

Ubuntu

$ lsb_release -a

Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Apache

require 'fileutils'
require 'json'
class Record
def initialize(path)
@source = path
@json = parse_json
@name = @source.sub '.geojson', ''
@before = @json.dig 'name'
@features = @json.dig 'features'
for volume in ./www.nyu.edu/calabash/vol*; do
volume_name=$(basename $volume)
for pdf in $volume/*.pdf; do
doc_name=$(basename $pdf .pdf)
pdf_dir="./data/${volume_name}/pdf"
png_dir="./data/${volume_name}/png/${doc_name}"
ocr_dir="./data/${volume_name}/ocr/${doc_name}"
echo "converting $doc_name"
mkdir -p $pdf_dir $png_dir $ocr_dir
@mnyrop
mnyrop / tiff-convert.sh
Last active November 5, 2020 19:29
convert jpeg to tiff, no resizing
TIFF_DIR="tiffs"
if [ ! -d "${TIFF_DIR}" ];
then
mkdir ${TIFF_DIR}
fi
for JPG in *.jpg; do
TIFF="$(basename ${JPG} .jpg).tiff"
convert -compress none ${JPG} ${TIFF}

blacklist ips with apache conf (instead of .htaccess)

setup/enable ip blacklist (only once!)

  • edit apache conf to use blacklist using command /etc/apache2/apache2.conf. add the following lines:
    # Block ip addresses in our ipblacklist.conf file
    <Location />
       <RequireAll>
          Require all granted
    

Include /etc/apache2/ipblacklist.conf

Tools

  • Docker: A "containerization tool" that bundles software needed for Wax (e.g, Jekyll, etc.) into a disposable, virtual computer (kinda)
  • Git: An open source software for tracking and committing changes to various files
  • Command Line Interface (e.g., Terminal): a non-graphical interface for telling your computer to do things, like run Wax's processing tasks or serve your site to a browser.
  • Text Editor (e.g., Atom): a program for editing files in "plain-text," (as opposed to "rich text") that is more geared towards machine-readability and reusability.
  • Web Browser (e.g., Firefox): a graphical interface for rendering sites and site data (can render "local" as well as "remote" content)

Services

  • Google Sheets & Drive: service/platform for storing and sharing content
  1. Install GitForWindows

skip if you already have GitBash working

  1. Uninstall "ImageMagick Display" app if you installed it previously.

skip if running convert -version in GitBash gives you something like Version: ImageMagick 7.0.11-1 .....

  1. Install Ruby using the RubyInstaller for Windows 10

IMPORTANT! Make sure you install a Ruby version > 2.4 and less than 3.0! Recommended is “Ruby+Devkit 2.7.3-1”. On the last step of the installation wizard, make sure to run the ridk install option. skip if running ruby -v in GitBash gives you a proper version >=2.4 & < 3.0

  1. Install ImageMagick by following the instructions on the ImageMagick Downloads page

IMPORTANT!!! About half way down one of the install option menus is a checkbox with something like “Install legacy components (convert.exe etc)”. Tick this box!!!!!!!

  1. Follow instructions on

Steps:

  1. Download and install Atom
  2. Make sure you have Docker and Git installed (instructions)
  3. Open Terminal (Mac) or GitBash (Windows) and run the following commands one at a time:
    a. git --version
    b. docker -v
    Each command should return some info with a number, e.g., Docker version 20.10.6, build 370c289
  4. Log into your GitHub account. (Or sign up if you don’t have one!)
  5. Head to the Wax repository and click “Use this Template” button (Green). It will prompt you to create a copy of the repository in your own account. You should name it after the collection or exhibition you’ll make, since this name will inform your free URL for the project with GitHub. For this example, our repository is called “my-wax-site”.
  6. On your own, new Wax repository page, click the Green “Code” button and copy the URL it provides to your clipb