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
function reverse(a) { | |
return a.length ? reverse(a.slice(1)).concat([a[0]]) : []; | |
} |
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
var path = require('path'); | |
// require(X) from module at path Y | |
function resolve(x, y) { | |
// 1. If X is a core module, | |
// a. return the core module | |
// b. STOP | |
if (isCoreModule(x)) { | |
console.log(x + " is a core module"); | |
} |
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
set terminal png size 1378,768 | |
set output 'result.png' | |
set xrange [-2000:30000] | |
set boxwidth 200 absolute | |
set style fill solid 1.0 noborder | |
bin_width = 1000; | |
bin_number(x) = floor(x/bin_width) | |
rounded(x) = bin_width * ( bin_number(x) + 0.5 ) | |
plot 'result.txt' using (rounded($1)):(1.0/20) smooth frequency with boxes |
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 | |
for i in {1..20}; do | |
ant run | |
result=`grep "No solution" ASearchDialog.txt` | |
if [ ! -z "$result" ]; then | |
echo "-1" >> result.txt | |
else | |
result=`grep -o "Total number of searched nodes:[0-9]\+" ASearchDialog.txt | grep -o '[0-9]\+$'` | |
echo $result >> result.txt |
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
# Download JDK | |
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u65-b17/jdk-7u65-linux-x64.tar.gz | |
# Untar JDK | |
tar xvzf jdk-7u65-linux-x64.tar.gz | |
# Remove the tar.gz | |
rm jdk-7u65-linux-x64.tar.gz | |
# set env var |
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
var courses = $("#score-result table tbody tr"); | |
var totalCredit = 0.0, totalProduct = 0.0; | |
courses.each(function(idx, course) { | |
var cells = $(course).children("td"); | |
if (cells[3].textContent !== "公选") { | |
var credit = parseFloat(cells[2].textContent); | |
var score = parseFloat(cells[5].textContent); | |
totalCredit += credit; |
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
var tr = $("#score-result table tbody tr"); | |
var credit_total = 0.0, total = 0.0; | |
tr.each(function(idx, row) { | |
var credit = parseFloat($(row).children('td')[0].textContent); | |
var score = parseFloat($(row).children('td')[2].textContent); | |
credit_total += credit; | |
total += score * credit; | |
}); |
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
for z in *.zip; do | |
d=`basename $z .zip` | |
mkdir $d && unzip $z -d $d | |
if [ -d "$d/src" ]; then | |
cp ../_s1/* $d/src/ | |
if [ -f "$d/src/makefile" ]; then | |
rm $d/src/makefile | |
fi | |
cd $d/src/ | |
make |
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
#!/bin/bash | |
write_to_file() | |
{ | |
file="loaddata.sql" | |
if [ ! -f "$file" ] ; then | |
touch "$file" | |
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
USE tpch; | |
LOAD DATA LOCAL INFILE '/home/joyeecheung/tpch_2_16_1/dbgen/region.tbl' INTO TABLE REGION | |
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n'; | |
LOAD DATA LOCAL INFILE '/home/joyeecheung/tpch_2_16_1/dbgen/nation.tbl' INTO TABLE NATION | |
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n'; | |
LOAD DATA LOCAL INFILE '/home/joyeecheung/tpch_2_16_1/dbgen/supplier.tbl' INTO TABLE SUPPLIER | |
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n'; |