Skip to content

Instantly share code, notes, and snippets.

@megawertz
megawertz / restore_blackboard_names.sh
Created February 16, 2022 21:45
Command to remove Blackboard name additions from uploaded files.
# This works fine
for f in *.java; do i=$(echo $f | awk -F "_" '{print $5}'); mv "$f" $i; done
# Can also do this with awk's system command. Trying to work around spaces was quite the adventure here.
# https://unix.stackexchange.com/questions/148454/how-to-escape-spaces-etc-in-passed-variable-for-system-call-to-cp-in-awk
find . -name "*.java" -exec echo '{}' \; | awk -F "_" '{system("echo '\''" $0 "'\'' " $5)}'
@megawertz
megawertz / echo.pl
Created November 14, 2017 17:57
Echo form submitted data back to web browser for in-class demonstration purposes.
#!/usr/bin/perl
use URI::Query;
use Data::Dumper;
print "Content-Type: text/html\n\n";
print "You sent the server:\n\n";
print "<br><hr><br><pre>";
@megawertz
megawertz / bbgradeprep
Last active February 16, 2022 21:48
Basic script to unzip and configure downloaded assignment zip bundles from Blackboard. Makes it easy to get to grading quicker by organizing the directory a bit. The cleanandprep.sh file makes it easier to prep multiple downloaded bundles at once.
#!/bin/bash
# Original student zip files go here after processing
DONEDIR="_done"
# Make sure we have a file to process and directory to go to
if [ $# -ne 2 ]; then
echo "Requires 2 Arguments: INPUT_FILE MAIN_OUTPUT_DIR"
exit
fi
@megawertz
megawertz / bashsnippets.sh
Created October 17, 2013 01:27
Some basic bash snippets I use to introduce shell scripting to my Linux class.
#!/bin/bash
# viewing environment variables
echo "The value of the home variable is: "
echo $HOME
# issue a command
echo "The output of the pwd command is: "
pwd
@megawertz
megawertz / freshbooksUnbilledStats.js
Last active January 12, 2016 18:59
Gets unbilled hours from Freshbooks and formats them into a CSV for Panic's Status Board app. This only shows unbilled totals per project. It suits my needs but yours will probably differ.
// Get unbilled hours from Freshbooks and show them in Panic's Status Board
// This assumes A LOT and is built for my usage. YMMV.
var sys = require('sys');
var fs = require('fs');
var exec = require('child_process').exec;
var parseString = require('xml2js').parseString;
var projListChild, timeEntryListChild;
@megawertz
megawertz / libsynstats.js
Created May 15, 2013 14:09
Node script that retrieves Libsyn podcast download stats and displays them on Panic's Status Board app and as HTML. Displays LES and total downloads. Based on Marco Arment's PHP script at https://gist.github.com/marcoarment/5393014
// Node script to retrieve Libsyn stats and display on Panic's Status Board app & as HTML
// This is rough but functional
//
// Thanks to Marco Arment for doing the hard work
// Based on https://gist.github.com/marcoarment/5393014
var sys = require('sys');
var fs = require('fs');
var exec = require('child_process').exec;
@megawertz
megawertz / gist:4245483
Created December 9, 2012 15:03
Tag iTunes Videos as Combined HD-SD
# Download and install mp4tags command line utility and add to path
# OPTIONAL: Find the video on iTunes and select Copy Link. From the end of the link extract the 9 number video ID.
# Tag each movie
mp4tags -I 123456789 -H 1 -i movie MOVIE_HD.m4v
mp4tags -I 123456789 -H 0 -i movie MOVIE_SD.m4v
# Drag into iTunes together and they should be listed as HD-SD
@megawertz
megawertz / gist:3628597
Created September 5, 2012 00:47
My AppleDoc Generation Settings
# Assumes you are using the entire project and the project directory is your current working directory.
# Each option is on its own line for readability.
# This only generates an HTML docset and doesn't install it into Xcode.
appledoc
--project-name CopyandPaste-Inator
--project-company "Doofenshmirtz Evil Inc."
--company-id com.doofenshmirtevilinc
--create-html
--no-install-docset
@megawertz
megawertz / autoVersion
Created February 17, 2012 18:54
Auto-Version Xcode Projects Using Git Tags & Commits
# Sets the CFBundleShortVersionString of the Xcode project to the last git tag
# Sets the CFBundleVersion number to one of 3 options below
git=/usr/bin/git
fullVersion=`$git describe --dirty`
# Use the most recent git tag for the CFBundleShortVersionString
appVersion=`echo $fullVersion | cut -d '-' -f1 | sed 's/v//'`
# Use the most recent commit hash for CFBundleVersion