Skip to content

Instantly share code, notes, and snippets.

View cwpearson's full-sized avatar
🙀
I have approximate knowledge of many things.

Carl Pearson cwpearson

🙀
I have approximate knowledge of many things.
View GitHub Profile
@cwpearson
cwpearson / ppc64le_install_go.sh
Last active June 5, 2017 17:20
Use binary go1.8.3 to boostrap gvm and associated go1.8.3 on ppc64le
#! /bin/bash
set -e
VERSION=1.8.3
OS=linux
ARCH=ppc64le
NAME=go$VERSION.${OS}-$ARCH.tar.gz
echo "==== Downloading go..."
curl -fsS https://storage.googleapis.com/golang/$NAME -o $NAME
#! /bin/bash
set -e
git clone https://github.com/Masterminds/glide.git $GOPATH/src/github.com/Masterminds/glide
cd $GOPATH/src/github.com/Masterminds/glide
make build
cp -v glide ~/bin/.
@cwpearson
cwpearson / dl-gaia.sh
Created November 1, 2018 11:29
Download gaia data release 2
#! /bin/bash
index_url="http://cdn.gea.esac.esa.int/Gaia/gdr2/gaia_source/csv/"
index_html=`curl $index_url`
while read -r line; do
# echo $line;
match=`echo $line | grep -oE 'href\="(.*.csv.gz)'`;
# echo $match;
match=${match#href=\"} ;# remove prefix starting with 'href="'
#! /bin/env python
"""converting airline dataset from GBM-benchmarks to svm"""
import pandas as pd
with open('airline_14col.data') as f:
num_lines = sum(1 for line in f)
print(num_lines)
#! /bin/env python
"""Convert higgs dataset from GBM-Benchmarks to libsvm format"""
import pandas as pd
with open('HIGGS.csv') as f:
num_lines = sum(1 for line in f)
print(num_lines)
@cwpearson
cwpearson / coo-impl.hpp
Last active April 2, 2019 18:13
Example COO/CSR implementation. Read the comments at the bottom.
#pragma once
#include <set>
#include "coo.hpp"
#ifdef __CUDACC__
#define PANGOLIN_HOST __host__
#define DEVICE __device__
#else
@cwpearson
cwpearson / edge_list_file.hpp
Created April 2, 2019 18:19
Reader for TSV or BEL files
#pragma once
#include <cassert>
#include <string>
#include "pangolin/edge_list.hpp"
namespace pangolin {
/*! check if base string ends with suffix string
@cwpearson
cwpearson / rsync-examples.md
Last active March 22, 2024 06:21
rsync examples
  • Copy a file to a remote server (with resume if interrupted).

rsync -avz --progress --partial --append-verify file user@remote:path

on macos, you may need

rsync -avz --progress --partial --append file user@remote:path

--progress prints progress. --partial tells the remote to keep partially-transferred files.

@cwpearson
cwpearson / clang5.sh
Last active March 25, 2022 16:02
Use clang5 to bootstrap clang5+openmp+libcxx
#! /bin/bash
set -eou pipefail
workdir=`mktemp -d -p $HOME`
workdir=`readlink -f $workdir`
echo $workdir
#trap "{ echo cleaning up $workdir; rm -r $workdir; }" EXIT
trap "{ echo workdir was $workdir; }" EXIT
@cwpearson
cwpearson / clang8.sh
Last active June 13, 2019 12:50
Use clang8 to bootstrap clang8+openmp+libcxx+compiler-rt
#! /bin/bash
set -eou pipefail
workdir=`mktemp -d -p $HOME`
workdir=`readlink -f $workdir`
echo $workdir
#trap "{ echo cleaning up $workdir; rm -r $workdir; }" EXIT
trap "{ echo workdir was $workdir; }" EXIT