Skip to content

Instantly share code, notes, and snippets.

View nuex's full-sized avatar
👾

Chase James nuex

👾
  • Lexington, KY
View GitHub Profile
@nuex
nuex / helpers.awk
Created September 16, 2011 20:06
render.awk - render an html, given a layout, metadata, and a markdown page
function load_helpers() {
data["page_title"] = page_title()
}
function page_title( title) {
if (data["title"]) {
title = data["title"] " - "
}
@nuex
nuex / scan.sh
Created October 20, 2016 03:45
convert scanned docs to tiny pdfs
#!/bin/sh
outname="$1"; shift
target="${outname}.tif"
scanimage --format tiff --resolution 300 --mode Gray > "$target" && \
convert "$target" -colorspace gray -level 10%,90%,1 -blur 2 +dither -monochrome "${outname}_bw.tif" && \
tiff2pdf -o "${outname}.pdf" "${outname}_bw.tif"
@nuex
nuex / getEmails.js
Created August 16, 2016 21:02
function for converting labelled gmail emails to a spreadsheet
function getEmails() {
// set spreadsheet and retrieve labels
var ss = SpreadsheetApp.getActiveSpreadsheet();
var name = "LABEL";
// create sheets and clear content
var label = GmailApp.getUserLabelByName(name);
var sh = ss.getSheetByName(label.getName()) ||
ss.insertSheet(label.getName(), ss.getSheets().length);
sh.clear();
@nuex
nuex / page-sync.php
Last active June 13, 2016 06:05
Sync a directory of static html pages with Wordpress
<?php
$dir = '/var/www/html';
if (getenv('WORDPRESS_PATH')) {
$dir = getenv('WORDPRESS_PATH');
}
require_once($dir . '/wp-load.php');
class PageSync
{
public static function export() {
@nuex
nuex / html5vid.sh
Created June 20, 2011 19:35
make a bunch of html5 video formats from a source video
#!/bin/sh
# html5vid.sh
#
# Encode an input video to multiple html5-ready formats:
# - webm
# - ogv
# - mp4
# - png (50th frame)
#
@nuex
nuex / goal-calc
Created October 7, 2012 18:07
goal-calc
#!/usr/bin/awk -f
#
# goal-calc
#
# Returns a weekly budget amount given the date of your next
# paycheck, a target date, and a target amount.
#
# USAGE
#
# If you're next paycheck will be arriving on 2011/08/29 and you have
@nuex
nuex / budget-calc
Created October 7, 2012 18:07
budget-calc
#!/usr/bin/awk -f
#
# budget-calc
#
# Builds a budget to save for upcoming bills
#
# USAGE
#
# Given a budget file like this with bill costs per month:
#
@nuex
nuex / rlc.sh
Created August 12, 2011 16:50
rlc - resize like crazy - resize all images in a directory recursively
#!/bin/sh
#
# rlc: resize like crazy
#
# rlc.sh targetdir
target=$1
destination=$target-resized
dimensions=1000x
quality=100
@nuex
nuex / import_osxfnt.sh
Created November 29, 2010 15:53
Imports OSX fonts from a zip file
#!/bin/sh
#
# Synopsis:
# Sometimes I have to use MACOSX fonts on my Linux machine.
# They come in from a zip file, but the fonts are hidden files
# in a __MACOSX directory in the zip. This script handles
# unzipping the file, moving the hidden font files into my user
# font directory and updating my font cache automatically.
#
# Description: