Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# TO USE:
# 1. install imagemagick
# 2. place this file in a directory full of .tif files to convert
# 3. in the terminal, navigate into the directory of images and run $ `bash sudan_photo_resizer.sh`
# NOTE:
# image filenames CANNOT include whitespace
# for best results, use snake_case naming with no capitalization.
@mnyrop
mnyrop / lunr-display-results.js
Created September 13, 2017 20:31
sample jquery for dynamic display of lunr query results (for jekyll CI post)
$(document).ready(function() {
$('input#search').on('keyup', function () {
var resultdiv = $('#results');
// Get query
var query = $(this).val();
// Search for it
var result = idx.search(query);
// Show results
resultdiv.empty();
for (var item in result) {
from os import path
from glob import glob
from tqdm import tqdm
import time
from pyPdf import PdfFileWriter, PdfFileReader
def find_ext(dr, ext):
return glob(path.join(dr,"*.{}".format(ext)))
files = find_ext("pdfs","pdf")
@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}

Recipe to fill two 1 liter bottles of ginger beer

Syrup:

  • 4+ oz of ginger (chopped roughly or smashed w mortar and pestle. no need to peel.)
  • 1/2 cup sugar (can use white, turbinado, or light brown)
  • 2 cups cold water
  • Some flavs (e.g. lime/lemon juice + rinds, bay leaves, cayenne peppercorns, turmeric, etc.)
require 'faker'
require 'csv'
require 'yaml'
task :fake_data do
I18n.enforce_available_locales = false
Dir.mkdir('_data') unless File.exists?('_data')
collection_names = []
3.times do # 3 csv files
csv = []
@mnyrop
mnyrop / Vagrantfile
Last active March 7, 2018 17:36
wax vm config
# -*- mode: ruby -*-
# vi: set ft=ruby :
# to use forwarded_port, serve jekyll with --host 0.0.0.0
Vagrant.configure("2") do |config|
config.vm.box = "marii/wax"
config.vm.box_version = "0.0.1"
config.vm.network "forwarded_port", guest: 4000, host: 4000
config.vm.provider "virtualbox" do |v|
v.memory = 4096
@mnyrop
mnyrop / wax_readme.md
Last active June 12, 2018 16:02
wax collection sample readme

{{ Site Name }}

[Build Badge] [Dependency Badge]

{{ Site Description }}

Basic Information:

  • Contact: {{ Name }}, {{ Group }}
  • Target url: e.g. https://example.com
  • Target host type: e.g., s3, nginx, or gh-pages
  • Bucket: _____ (if using s3)
@mnyrop
mnyrop / columbiaswc-b-dh-box.md
Last active August 22, 2018 16:26
dh box setup

DH Box Instructions

for folks who can't get their systems working

  • Go to http://dhbox.org/
  • Sign up for an account for 1 week
  • When you're logged in, click your username in the top right corner and select Apps
  • Near the top, navigate to the 'Command Line' tab
  • Type in your username and hit enter.
  • When prompted, type in your password and hit enter. The cursor will not move when you type.
  • Once you're logged in to the shell, enter the following commands, hitting enter after each one: