Skip to content

Instantly share code, notes, and snippets.

View aubreyja's full-sized avatar

Jason Aubrey aubreyja

View GitHub Profile

Git post-commit hook to keep master and gh-pages branch in sync :

In your Git repository create a file .git/hooks/post-commit and fill it with this:

#!/bin/sh
git checkout gh-pages
git rebase master
git checkout master
@aubreyja
aubreyja / firewall_rules.sh
Created January 14, 2013 23:23
Firewall rules for a webwork server
#!/bin/bash
# Delete all existing rules
iptables -F
# Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@aubreyja
aubreyja / gist:3372878
Created August 16, 2012 19:24
embed video (and other stuff) in webwork problem
TEXT(MODE(TeX=>"Video Help Object", HTML=><< END_EMBED));
...html for embedding your video...
END_EMBED
@aubreyja
aubreyja / macro_template.pl
Created August 12, 2012 02:56
macro_template.pl
# Put this in your course macros directory, define any custom subroutines you want and then use them in
# problems by including the file in loadMacros() calls.
sub _init_macro_template {
#Possibly add initialization code here
#sub routine is not required, but prevents the macro from being re-loaded
}
#Now defined your custom subroutines for use in problem authoring.
@aubreyja
aubreyja / AskSage.pm
Created August 9, 2012 18:44
AskSage.pm
use HTTP::Tiny;
use JSON;
package AskSage;
sub new {
my $class = shift;
my $self = {
url => 'http://aleph.sagemath.org/service',
req => HTTP::Tiny->new(),
@aubreyja
aubreyja / gist:2869952
Created June 4, 2012 18:13
ww_install
#!/usr/bin/env perl
##########################################################################################################
#WeBWorK Installation Script
#
#Goals:
#(1) interactively install webwork on any machine on which the prerequisites are installed
#(2) do as much as possible for the user, finding paths, writing config files, etc.
#(3) never use anything other than core perl modules, webwork modules, webwork prerequisite modules
#(4) eventually add options for --nointeractive, --with-svn, other?
#
@aubreyja
aubreyja / gist:1910097
Created February 25, 2012 19:01
netpbm--svn-HEAD/converter/other$ make pnmtops
cc -no-cpp-precomp -O3 -ffast-math -pedantic -fno-common -Wall -Wno-uninitialized -Wmissing-declarations -Wimplicit -Wwrite-strings -Wmissing-prototypes -Wundef -Wno-unknown-pragmas -c -o pnmtops.o pnmtops.c
pnmtops.c:49:23: error: pm_c_util.h: No such file or directory
pnmtops.c:50:17: error: pam.h: No such file or directory
pnmtops.c:51:23: error: mallocvar.h: No such file or directory
pnmtops.c:52:20: error: shhopt.h: No such file or directory
pnmtops.c:53:21: error: nstring.h: No such file or directory
pnmtops.c:66: error: expected specifier-qualifier-list before ‘bool’
pnmtops.c:86: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘verbose’
pnmtops.c: In function ‘parseDpi’:
pnmtops.c:100: warning: implicit declaration of function ‘pm_error’
@aubreyja
aubreyja / netpbm.log
Created February 25, 2012 18:48
brew install -vd --HEAD netpbm
==> Checking out http://netpbm.svn.sourceforge.net/svnroot/netpbm/trunk
/usr/bin/svn up --force /Users/jason/Library/Caches/Homebrew/netpbm--svn-HEAD
At revision 1656.
/usr/bin/svn export --force /Users/jason/Library/Caches/Homebrew/netpbm--svn-HEAD /private/tmp/homebrew-netpbm-HEAD-FsjO
Export complete.
==> cp config.mk.in config.mk
cp config.mk.in config.mk
==> make
make
cat /dev/null >depend.mk
@aubreyja
aubreyja / gist:1541432
Created December 30, 2011 20:53
Sage single cell webwork embed test (courtesy of Jason Grout)
TEXT(<<'EOF');
<div id="singlecell-test"><script type="text/code">var('x')
x0 = 0
f(x) = sin(x)*e^(-x)
p = plot(f,(x,-1,5), thickness=2)
dot = point((x0,f(x=x0)),pointsize=80,rgbcolor=(1,0,0))
@interact
def _(order=(1..12)):
ft = f.taylor(x,x0,order)
pt = plot(ft,(x,-1, 5), color='green', thickness=2)