Skip to content

Instantly share code, notes, and snippets.

View rdrew's full-sized avatar

Rob Drew rdrew

View GitHub Profile
@rdrew
rdrew / downsampler.sh
Last active February 5, 2026 17:15
PDF (Scanned image) Downsample to 72 DPI
#!/usr/bin/env bash
set -euo pipefail
# ---- requirements check ----
command -v gs >/dev/null 2>&1 || {
echo "Error: Ghostscript (gs) is not installed."
exit 1
}
--resize from 600 to 300 dpi
convert 000001.tif -resize 50% -density 300 -units pixelsperinch 000001_mod.tif
@rdrew
rdrew / sox_commands.txt
Created June 1, 2018 15:39
SOX commands (audio processing)
**this acts a hard limiter at -20db**
sox in.wav out.wav compand 0,0 0:-20,-20,0,-20
**convert to mono**
sox infile outfile channels 1
**normalize audio to 0db**
sox infile outfile gain −n
**normalize audio to -3db**
@rdrew
rdrew / daily_scan_logger.cmd
Created May 16, 2018 18:55
scan pdf folder and log file metadata
:: check for / create log dir
IF NOT EXIST "log\" MD log
::Set Variables
SET temp_file=log\tmp.txt
SET datestr=%date:~10,4%-%date:~7,2%-%date:~4,2%
SET output_file=log\scan-log_"%datestr%".txt
:: loop through pdfs and dump data to temp_file
@rdrew
rdrew / template.php
Created April 26, 2018 18:47
D7: pulling theme css and js out of aggregation
<?php
/**
* @file
* Template overrides as well as (pre-)process and alter hooks for the
* lmmi_2015 theme.
*/
drupal_add_js(drupal_get_path('theme', 'lmmi_2015') . '/dist/assets/js/app.js', array(
'preprocess' => FALSE,
'group' => JS_THEME,
// these are the section titles found on the inserted separator sheets
var documentSections = [
'bookmark01',
'bookmark02',
'bookmark03',
'bookmark04'
];
// this gives us the master filename without the extension
var docTitle = this.documentFileName.replace(/\.[^/.]+$/, "");
@rdrew
rdrew / config.yml
Created November 30, 2017 15:46
config file for gulpsetup
#Url of the site to be proxied
URL: "cbufaces.cairnrepo.org"
#Root assets folder (contains /css/, /js/ etc)
ASSETS_DIR: "dist/assets"
#Path on server to remote assets folder (escape the slashes; no trailing slash)
REMOTE_ASSETS_PATH: "http://cbufaces.cairnrepo.org/sites/cbufaces.cairnrepo.org/themes/cbu_scholar/dist/assets"
LOCALPROXY: "http://drupal7.dev/"
@rdrew
rdrew / gulpfile.babel.js
Last active November 30, 2017 15:47
Newest setup for F6 in Proxy mode
'use strict';
import plugins from 'gulp-load-plugins';
import yargs from 'yargs';
import browser from 'browser-sync';
import gulp from 'gulp';
import panini from 'panini';
import rimraf from 'rimraf';
import sherpa from 'style-sherpa';
import yaml from 'js-yaml';
@rdrew
rdrew / javascript_code_snippets.js
Last active November 30, 2017 14:21
JS code snippets
//const imagePath = '/sites/all/themes/cbu_scholar/dist/assets/img/';
const imagePath = '/sites/cbufaces.cairnrepo.org/themes/cbu_scholar/dist/assets/img/';
//const imagePath = '/img/';
var menuItems = [
{
title: 'Twitter',
icon: 'twitter.svg'
},
{
"repositories": [
{
"type": "vcs",
"url": "git@github.com:myprivate/repo.git",
"options": {
"ssh2": {
"username": "root",
"pubkey_file": "/root/.ssh/id_rsa.pub",
"privkey_file": "/root/.ssh/id_rsa"