This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UTILITY FUNCTIONS | |
def preamble(): | |
"""Prints the mandatory opening lines of any CGI script.""" | |
print "Content-Type: text/html" | |
def parseCss(css): | |
"""Convert a CSS class or id name into a string of the form class=var or id=var, with quotes around var. | |
String css -> css tag to convert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function escapeSpaces () { | |
if [[ -n $1 ]]; then | |
string=`echo $1 | sed -r 's/[ ]+/\\\\\\ /g'` | |
echo "$string" | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Abort if not super user | |
if [[ ! `whoami` = "root" ]]; then | |
echo "You must have administrative privileges to run this script" | |
echo "Try 'sudo ./install-java.sh'" | |
exit 1 | |
fi | |
# Check that the file is a JDK archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Method to format a BigDecimal for printing as an amount of currency. Only works for locales | |
* where the currency symbol is placed before the amount. | |
* @param n the value to format | |
* @returns the formatted String | |
*/ | |
public String formatCurrency(BigDecimal n) { | |
String symbol = Currency.getInstance(Locale.getDefault()).getSymbol(); | |
String value = new DecimalFormat("#,###.00").format(n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Script to mount or unmount a remote filesystem via sshfs | |
SERVERNAME="user@host.name" | |
MOUNTPOINT="$HOME/cs-home" | |
if [[ ! -d "$MOUNTPOINT" ]]; then | |
mkdir $MOUNTPOINT | |
fi | |
if [[ -d "$MOUNTPOINT/Private" ]]; then |