Skip to content

Instantly share code, notes, and snippets.

View lightscalar's full-sized avatar

Matthew J. Lewis lightscalar

View GitHub Profile
@lightscalar
lightscalar / .vimrc
Last active April 16, 2016 16:45
My current .vimrc file
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@lightscalar
lightscalar / titan_gpu.md
Created November 11, 2015 01:32
Get GPU working properly...

Remember

sudo ldconfig /usr/local/cuda-7.5/lib64
@lightscalar
lightscalar / keras.md
Last active August 31, 2015 14:30
Installing Keras, etc., on Ubuntu

Assuming numpy, scipy, & Theano are already installed. Make sure you install:

sudo apt-get install libhdf5-dev/

So that the headers can be discovered. Then we install h5py:

sudo pip install h5py
@lightscalar
lightscalar / ffmpeg.md
Last active August 29, 2015 14:21
Break an MP4 file into sequence of JPG frames

This is straightforward to do with ffmpeg:

ffmpeg -y -r 1000 -i "myfile.mp4" -sameq "image.%06d.jpg"

To convert h.264 format to mp4, install the following utility:

sudo apt-get install gpac

And then,

MP4Box -add filename.h264 filename.mp4
# To run this command (copied from user tianhuil):
# curl https://gist.githubusercontent.com/tianhuil/0aa9b265f55413dc7198/raw > setup_digitalocean.sh
# . setup_digitalocean.sh
# Update sudo apt-get
sudo apt-get update
# Installing scientific Python
sudo apt-get -y install --fix-missing build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev
sudo apt-get -y install --fix-missing build-essential python-sklearn
@lightscalar
lightscalar / ember-install.md
Last active August 29, 2015 14:19
Getting NPM & Ember Running Properly

Installing Ember/Ember-CLI

For God's sake use the node version manager. First, you need to wipe everything clean.

rm -rf ~/.npm ~/.nvm

Next, install the node version manager (NVM).

@lightscalar
lightscalar / install_python.md
Last active August 29, 2015 14:11
Getting set up with python on a new Mac (using MacPorts)

Install the usual scientific packages like so:

sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose

Now ensure that the relevant versions are active:

sudo port select --set python python27
@lightscalar
lightscalar / object_iteration.md
Last active January 6, 2025 13:22
Iterating Over Object Attributes in Python

Given an object in Python, we can iterate over its attributes (much as we might iterate over keys in a dictionary) by using the following method. In this example, we convert an object into a list of the attribute contents of the object.

[data.__dict__[key] for key in data.__dict__.iterkeys()]

So, given a class,

class Example():
@lightscalar
lightscalar / reload.md
Last active August 29, 2015 14:02
Autoreload Python Modules

If you would like to autoreload changed modules in python, this'll do it:

%load_ext autoreload
%autoreload 2