Skip to content

Instantly share code, notes, and snippets.

View yzhang1991's full-sized avatar
🏠
Working from home

Yiqun (Ethan) Zhang yzhang1991

🏠
Working from home
View GitHub Profile
@yzhang1991
yzhang1991 / runUDF.sql
Created October 6, 2017 19:56
runUDF.sql
SELECT SUM(CASE WHEN nb_classify(sepal_length,
sepal_width,
petal_length,
petal_width) = class THEN 1 ELSE 0 END) AS nb_correct,
SUM(CASE WHEN knn_classify(sepal_length,
sepal_width,
petal_length,
petal_width) = class THEN 1 ELSE 0 END) AS knn_correct,
COUNT(*) AS total
FROM iris;
@yzhang1991
yzhang1991 / Iris.sql
Created October 6, 2017 19:55
Iris.sql
CREATE TABLE iris (
sepal_length FLOAT NOT NULL,
sepal_width FLOAT NOT NULL,
petal_length FLOAT NOT NULL,
petal_width FLOAT NOT NULL,
class VARCHAR(20) NOT NULL
);
@yzhang1991
yzhang1991 / KNNClassify.java
Created October 6, 2017 19:28
The classify UDF example
public String classify(double sepal_length, Double sepal_width, double petal_length, Double petal_width) {
if (knnc == null) {
throw new RuntimeException("Please run the IrisKNNClassifier procedure first to train the model.");
}
// Assemble the attributes together.
DenseInstance dataRow = new DenseInstance(attributeCount);
dataRow.put(0, sepal_length);
dataRow.put(1, sepal_width);
dataRow.put(2, petal_length);
dataRow.put(3, petal_width);
@yzhang1991
yzhang1991 / IrisKNNClassifier.java
Created October 6, 2017 19:26
IrisKNNClassifier example
public class IrisKNNClassifier extends VoltProcedure {
// The query to extract the data from a VoltDB table.
public final SQLStmt selectData =
new SQLStmt("SELECT sepal_length, sepal_width, petal_length, petal_width, class FROM iris;");
// Number of attributes.
private static final int attributeCount = 4;
private static Classifier knnc;
// The train method (Java stored procedure).
public long run() {

Building lldb on Mac

Create Codesign Certificate

First we need to create a certificate. The llvm provided a way to do that, but I found this way to work slightly better for me. Just substitute lldb_codesign for the certificate name, instead of gdb-cert.

Install swig dependency

@yzhang1991
yzhang1991 / scidb-install.txt
Last active January 25, 2018 15:00
Install SciDB
scp yzhang@linux04.cs.uh.edu:~/packages/scidb-15.7.0.9267.tgz ./
tar -xzf scidb-15.7.0.9267.tgz
mv scidb-15.7.0.9267/ scidbtrunk
sudo apt-get update
sudo apt-get -y install subversion expect openssh-server openssh-client
# The following environment variables should go into ~/.bashrc
export SCIDB_VER="15.7"
export SCIDB_SOURCE_PATH="/home/scidb/scidbtrunk"
@yzhang1991
yzhang1991 / hadoop-install.txt
Last active April 30, 2020 03:00
Hadoop install
sudo apt-get install -y lib64z1-dev autoconf automake libtool libssl-dev findbugs
findbugs: http://findbugs.sourceforge.net/downloads.html
I found this may be useful: https://frankfzw.wordpress.com/2015/01/22/install-hadoop-2-6-0-on-ubuntu-server-14-04/
http://www.bogotobogo.com/Hadoop/BigData_hadoop_Install_on_ubuntu_single_node_cluster.php
apt-get update
apt-get install default-jdk
addgroup hadoop
@yzhang1991
yzhang1991 / dns
Created November 22, 2015 02:36
Temporary DNS
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null