Skip to content

Instantly share code, notes, and snippets.

View chyunsu3's full-sized avatar

Philip Hyunsu Cho chyunsu3

View GitHub Profile
@chyunsu3
chyunsu3 / test.cc
Last active November 14, 2018 05:24
Borrowing C++ string into Python safely
#include <string>
class Foo {
public:
Foo() : bar("foobar") {}
std::string bar;
};
extern "C" void CreateFoo(void** handle) {
*handle = static_cast<void*>(new Foo());
@chyunsu3
chyunsu3 / compile_libhdfs_mac_osx.sh
Created November 9, 2018 05:11
How to compile libHDFS and XGBoost on Mac OS X
#!/bin/bash
# Compile HDFS native library from source
cd
wget http://mirrors.advancedhosters.com/apache/hadoop/common/hadoop-3.1.1/hadoop-3.1.1-src.tar.gz
tar xvf hadoop-3.1.1-src.tar.gz
cd hadoop-3.1.1-src/hadoop-hdfs-project/hadoop-hdfs-native-client
CC=gcc-8 CXX=g++-8 mvn compile -Pnative # Use Homebrew GCC
# Create HDFS home under the home directory