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 / automatic1111.sh
Last active July 29, 2023 20:24
Install AUTOMATIC1111 on GCE
# install some useful stuff
sudo apt install -y htop
# On Debian 11 this brings python 3.9, but the docs ask for python 3.10.6
sudo apt install -y wget git python3 python3-venv
# install pyenv for newer pythons
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
@cwpearson
cwpearson / suitesparse-download.sh
Last active April 26, 2021 21:35
Bash script to download suitesparse matrices if they're missing
#! /bin/bash
set -eou pipefail
match_size_or_get() {
url=$1
echo "working on $url"
# get expected size of url content.
# first, follow redirects to get effective url
@cwpearson
cwpearson / llvm-10.0.0.sh
Last active May 11, 2020 22:07
Install llvm 10.0.0 to $HOME/software/llvm-10.0.0
#! /bin/bash
set -eou pipefail
set -x
workdir=`mktemp -d`
workdir=`readlink -f $workdir`
echo $workdir
#trap "{ echo cleaning up $workdir; rm -r $workdir; }" EXIT
@cwpearson
cwpearson / install-cmake.sh
Last active June 18, 2024 04:01
install CMake from source
set -eu
set -x
# create a `cmake` directory and extract cmake into there
# build cmake in there, and install to prefix
PREFIX=$HOME/software/cmake-3.17.0-rc3
wget -SL https://github.com/Kitware/CMake/releases/download/v3.17.0-rc3/cmake-3.17.0-rc3.tar.gz
mkdir -p cmake-3.17.0-rc3.src
#! /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
@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 / 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 / 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 / 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