Skip to content

Instantly share code, notes, and snippets.

@yhtgrace
yhtgrace / plex-setup.md
Created December 9, 2017 00:43
Setting up the plex media server on Ubuntu

Vanilla installation instructions can be found here. Note that setting permissions/chowning the directory turns out to be critical, ref here. The web app for managing the server is at localhost:32400. On Ubuntu, the data directory can be found at /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/.

For troubleshooting if the service is actually running, see here. If the directory does not have the right permissions (or runs out of space), the service will not run/break.

Information about moving the data directory can be found here.

So while attempting bootcamp, my computer crashed and created a ghost partition that refused to be fixed by Disk Utility. Specifically, while attempting to fix the problem, I kept running into

The provided Core Storage logical volume has an incorrect size; you should run whole-disk repair

particularly when trying to use Disk Utility to delete the new free space partition that had popped up, even in recovery mode. However, running*

diskutil repairDisk disk0

and then going through Disk Utility to delete the free space partition re-absorbed it into Macintosh HD. Yay?

@yhtgrace
yhtgrace / tensorflow_lr.py
Last active February 21, 2017 18:04
Tensorflow implementation of logistic regression with L1 regularizer
# placeholders
x_data = tf.placeholder(shape = [None, x.shape[1]], dtype = tf.float32)
y_target = tf.placeholder(shape = [None, 1], dtype = tf.float32)
# prediction
W = tf.Variable(tf.random_normal(shape = [x.shape[1], 1]))
b = tf.Variable(tf.random_normal(shape = [1]))
y_logits = tf.matmul(x_data, W) + b
y_hat = tf.round(tf.sigmoid(y_logits))
@yhtgrace
yhtgrace / local-tensorflow.md
Created February 5, 2017 17:53
Building tensorflow from source

Binary toolkit

Using conda makes installing tensorflow easy. The binary requires CUDA toolkit and cuDNN, which can also be installed locally. For CUDA, install with --toolkit and --toolkitpath to the directory of choice. Then, download cuDNN, and install by copying the files into the correct directory

cp cuda/include/cudnn.h /path/to/cuda/include
cp cuda/lib64/libcudnn* /path/to/cuda/lib64  

Set the environment variables so the correct CUDA/cuDNN is found

@yhtgrace
yhtgrace / kernelspecs.md
Last active April 19, 2018 17:27
jupyter kernelspec tricks with working on a docker-run notebook server

Following the advice here would have been far too sane. My excuse is that I already had my conda environments set up long before I came across that page. With that in mind:

To create an ipython kernelspec for a local conda environment, within that conda environment, run

ipython kernel install --prefix /path/to/kernel/prefix --name $name --display-name $display-name

where path/to/kernel/prefix can be invoked to write the file to a non-default path. Not that the kernel itself has to be installed within that environment. For example, in the case of Python, ipykernel must be installed (simply via conda install ipykernel) and ditto for other languages.

Then, within the docker environment,

Installing Haskell locally

Based on this, documenting how to install Haskell from nothing without sudo on Ubuntu 14.04 trusty.

  1. Download the GHC binary from here. GHC is the Haskell compiler and you need to bootstrap i.e. use GHC to compile GHC. To be exact, I downloaded the generic Linux binary for 7.10.1. configure with desired local prefix and make install.
@yhtgrace
yhtgrace / software-carpentry
Created June 24, 2015 18:07
The final Makefile from the software carpentry tutorial: http://software-carpentry.org/v4/make/, + notes
# include make files
include config.mk
# macros make life easier
WDP2PDF_FLAGS=--style $(STYLE_DIR)/euphoric.wps
SGR_FLAGS=-N -r -s $(STYLE_DIR)/euphoric.fig
paper.pdf : paper.wdp figure-1.svg figure-2.svg
wdp2pdf $(WDP2PDF_FLAGS) $<
@yhtgrace
yhtgrace / jupyter-nb-setup
Created May 4, 2015 23:40
jupyter notebook setup
pyvenv-3.4 sen
source sen/bin/activate
pip install --upgrade setuptools pip
git clone --recursive https://github.com/ipython/ipython.git
cd ipython
pip install -r requirements.txt -e .
git clone https://github.com/jupyter/jupyter_notebook.git
cd jupyter_notebook
@yhtgrace
yhtgrace / pythonpath-fix
Created April 24, 2015 15:49
Fixing PYTHONPATH for python 3.4 in bin/activate
# with pyvenv, activating my python 3.4 environment and running jupyter notebook
# gives the following error
# Your PYTHONPATH points to a site-packages dir for Python 2.x but you are running Python 3.x!
# PYTHONPATH is currently: "/usr/local/lib/python2.7/site-packages:"
# You should `unset PYTHONPATH` to fix this.
# To fix this, append this to the end of the bin/activate file
export PYTHONPATH=/usr/local/lib/python3.4/site-packages
@yhtgrace
yhtgrace / auto-live
Created April 21, 2015 20:51
auto-compilation for live previewing
# jekyll
jekyll serve -w
# latex
latexmk -pdf -pvc src/main.tex