Skip to content

Instantly share code, notes, and snippets.

@laurencedawson
laurencedawson / starfield.js
Created July 31, 2011 15:11
Javascript Starfield Demo
W=window;D=document;C=D.createElement("canvas");a=C.getContext("2d");w=W.innerWidth;h=W.innerHeight;C.width=w;C.height=h;D.documentElement.style.overflow="hidden";Z=D.body;Z.style.margin=0;C.style.display="block";Z.appendChild(C);q=[];m=Math;function c(){b=s;b.x=w/2;b.y=h/2;b.a=m.random()*10-5;b.b=m.random()*10-5}for(z=200;z--;)s={},c(),q.push(s);setInterval(function(){G=a.createRadialGradient(w/2,h/2,w,w/2,h/2,1);G.addColorStop(.8,"#fff");G.addColorStop(1,"#000");a.fillRect(0,0,w,h);for(i=200;i--;)s=q[i],a.beginPath(),a.strokeStyle=G,a.moveTo(s.x,s.y),a.lineTo(s.x+s.a,s.y+s.b),a.closePath(),a.stroke(),s.x+=s.a,s.y+=s.b,s.a+=s.a*.01,s.b+=s.b*.01,(s.x<0||s.x>w||s.y>h||s.y<0)&&c()},25)
@laurencedawson
laurencedawson / gist:1765403
Created February 8, 2012 04:17
CLI grab of CUDA driver
# Grab the latest NVIDIA driver
wget http://developer.download.nvidia.com/compute/cuda/4_1/rel/drivers/NVIDIA-Linux-x86_64-285.05.33.run
@laurencedawson
laurencedawson / gist:1765395
Created February 8, 2012 04:15
Grub editing
# Open the grub options in the nano editor
sudo nano /boot/grub/grub.cfg
# An example entry with the nomodeset appended
linux /boot/vmlinuz-3.0.0-14-... ro quiet splash vt.handoff=7 nomodeset
@laurencedawson
laurencedawson / gist:1765429
Created February 8, 2012 04:25
Installing the CUDA driver
# Stop the lightDM service
sudo service lightdm stop
# Start the driver installation
sudo sh NVIDIA-Linux-x86_64-285.05.33.run
@laurencedawson
laurencedawson / gist:1765446
Created February 8, 2012 04:28
Grab and install CUDA Toolkit
# Grab the latest version of the CUDA Toolkit (4.1)
wget http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/cudatoolkit_4.1.28_linux_64_ubuntu11.04.run
# Install the toolkit
sudo sh cudatoolkit_4.1.28_linux_64_ubuntu11.04.run
@laurencedawson
laurencedawson / gist:1765507
Created February 8, 2012 04:46
Make the SDK CUDA
# Navigate to the SDK dir
cd NVIDIA_GPU_Computing_SDK
# Compile the examples
sudo make
@laurencedawson
laurencedawson / gist:1765480
Created February 8, 2012 04:38
CUDA get and install SDK
# Grab the SDK direct from NVIDIA
wget http://developer.download.nvidia.com/compute/cuda/4_1/rel/sdk/gpucomputingsdk_4.1.28_linux.run
# Install the toolkit
sudo sh gpucomputingsdk_4.1.28_linux.run
@laurencedawson
laurencedawson / gist:1765497
Created February 8, 2012 04:41
Setup build
# Install the essentials to build the SDK examples
sudo apt-get install gcc-4.4 g++-4.4 build-essential
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4
@laurencedawson
laurencedawson / gist:1765472
Created February 8, 2012 04:35
Update PATH Cuda
# Open the environment settings in the nano editor
sudo nano /etc/environment
# Edit the existing environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
# To the new environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cuda/bin"
# Create a new file cuda.conf in the nano editor
@laurencedawson
laurencedawson / gist:1765505
Created February 8, 2012 04:45
Fix broken links cuda
# Install freeglut and libxi
sudo apt-get install freeglut3-dev libxi-dev
# Fix a missing link
sudo ln -s /usr/lib/libXmu.so.6 /usr/lib/libXmu.so
# Remove the dead link
sudo rm /usr/lib/libGL.so
# Add a new link in order to compile the OpenGL demos
sudo ln -s /usr/lib/libGL.so.285.05.33 /usr/lib/libGL.so