This file contains hidden or 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
TYPE | |
StrSet = set(str) | |
StrLifted = lift(StrSet) | |
State = Var -> StrLifted | |
PROBLEM Constant_Propagation | |
direction : forward | |
carrier : State |
This file contains hidden or 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
#!/bin/bash | |
# the first argument is the string you are looking for --> $1 | |
searchString="$1" | |
for f in `find . -type f -name "*.java"` | |
do | |
result=`grep "$searchString" $f` |
This file contains hidden or 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
import os | |
""" | |
validate_directory: string -> string | |
given a string that represents a directory, this function will go through and | |
do some basic validation on it. If there is a problem with the directory as | |
given, it will be converted to the home directory and returned as is. | |
""" | |
def validate_directory(directory=None): | |
if directory == None or directory == '~' or not os.path.isdir(directory): |
This file contains hidden or 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
import os | |
import sys | |
# add the offending text to file1.txt | |
f = open("file1.txt", 'r') | |
content = f.read() | |
contentArray = content.split('<br />') | |
for item in contentArray: | |
print item | |
# then copy/paste the console output |
This file contains hidden or 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
cat rsvpresults.yaml | grep 'totalPeople' | sed 's/totalPeople: //' | awk '{s+=$1} END {print s}' |
This file contains hidden or 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
# Convert a CSV like the following: | |
# a,b,c,d,e,f,g | |
# To the LaTeX table format like the following: | |
# {a} & {b} & {c} & {d} & {e} & {f} & {g} \\\hline | |
sed 's/,/} \& {/g' Table1.csv | sed 's/^/{/' | sed 's/$/} \\\\\\hline/' > Table1Format.txt |
This file contains hidden or 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
public CompilationUnit createParser(char[] contents) { | |
// Create the ASTParser which will be a CompilationUnit | |
ASTParser parser = ASTParser.newParser(AST.JLS4); | |
parser.setKind(ASTParser.K_COMPILATION_UNIT); | |
parser.setSource(contents); | |
parser.setResolveBindings(true); | |
CompilationUnit parse = (CompilationUnit) parser.createAST(null); | |
return parse; |
This file contains hidden or 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
public char[] getFileContents(File file) { | |
// char array to store the file contents in | |
char[] contents = null; | |
try { | |
// Read in the contents line by line storing them in a StringBuffer | |
BufferedReader br = new BufferedReader(new FileReader(file)); | |
StringBuffer sb = new StringBuffer(); | |
String line = ""; |
This file contains hidden or 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
#!/bin/bash | |
# Given a file, output a sorted list of unique items with the number of occurrences for each item next to it | |
fname=$1 | |
cat $fname | sort | uniq -c | |
exit 0 |
This file contains hidden or 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
#!/bin/bash | |
# Given a filename and a revision number, find the revision number previous to this one. | |
fname=$1 | |
curr=$2 | |
prev="" | |
for revnum in `svn log -q $fname | awk '/^r/ {print $1}' | sed -e 's/r//' | sort -n` | |
do |