Skip to content

Instantly share code, notes, and snippets.

💭
Working on MFlux.ai

Iver Jordal iver56

💭
Working on MFlux.ai
  • AIA Science
  • Trondheim, Norway
Block or report user

Report or block iver56

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iver56
iver56 / gfx
Last active Sep 26, 2015
IT3105: Graphics class for visualizing a 2D grid. Useful when implementing the A* algorithm. Uses pygame.
View gfx
import sys, pygame
pygame.init()
class Gfx(object):
"""
This class takes care of drawing the state of the search to a window using pygame
"""
size = width, height = 960, 540
@iver56
iver56 / test_huge.txt
Created Oct 5, 2015
A* navigation problelm
View test_huge.txt
(1600,1200)
(0,0) (1346,260)
(18,50,330,918)
(46,960,184,172)
(220,1060,136,140)
(388,0,42,1178)
(246,984,156,56)
(500,938,194,262)
(606,166,402,622)
(1088,146,62,1028)
View A* navigation problem
(800,600)
(0,0) (673,130)
(14,25,165,459)
(23,480,92,86)
(110,530,68,70)
(194,0,21,589)
(123,492,78,28)
(250,469,97,131)
(303,83,201,311)
(544,73,31,514)
@iver56
iver56 / gist:796ad44194278790eea5
Created Oct 23, 2015
Dump the sql that django generates
View gist:796ad44194278790eea5
import sqlparse
from django.db import connection
from django.core.signals import request_finished
def finished(sender, **kwargs):
for query in connection.queries:
print "\n" + "(" + query['time'] + " s) " + sqlparse.format(query['sql'], reindent=True, keyword_case="upper") + "\n"
if len(connection.queries) > 0:
print "NUMBER OF DB QUERIES FOR THIS REQUEST:", len(connection.queries)
request_finished.connect(finished)
@iver56
iver56 / gist:5c5c0e16a6f504e207c7
Last active Nov 7, 2015
Install CUDA 7.0 on Amazon EC2 g2.2xlarge running Ubuntu 14.04 trusty
View gist:5c5c0e16a6f504e207c7
sudo apt-get update
sudo apt-get -y dist-upgrade
# /boot/grub/menu.lst keep the local version. (or maybe not? replacing it could maybe be a good idea, and could avoid some of the hassle below)
sudo apt-get install -y gcc g++ gfortran build-essential git wget linux-image-generic libopenblas-dev python-dev python-pip python-nose python-numpy python-scipy linux-headers-generic-lts-trusty linux-source
# sudo apt-get install linux-headers-`uname -r`
sudo rm /boot/grub/menu.lst
sudo update-grub
@iver56
iver56 / gist:5f6a6dc5cdd7fc102dd4
Created Nov 21, 2015
Install CUDA on Amazon EC2 g2.2xlarge instance
View gist:5f6a6dc5cdd7fc102dd4
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get install -y gcc g++ gfortran build-essential linux-image-generic libopenblas-dev python-nose python-numpy python-scipy linux-headers-generic-lts-trusty linux-source
sudo rm /boot/grub/menu.lst
sudo update-grub
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
You can’t perform that action at this time.