Skip to content

Instantly share code, notes, and snippets.

main() {
# Only enable exit-on-error after the non-critical colorization stuff,
# which may fail on systems lacking tput or terminfo
set -e
if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh
fi
apt-get update
apt-get upgrade -y
apt-get install -y sudo htop vim screen sharutils zsh cifs-utils python-pip curl git
newuser="pimouss"
useradd ${newuser} --create-home
mkdir /home/${newuser}/.ssh
chmod 700 /home/${newuser}/.ssh
cp .ssh/authorized_keys* /home/${newuser}/.ssh/
chown -R ${newuser}.${newuser} /home/${newuser}/.ssh
smith@wesson:~$ /usr/bin/time -f "\trendered in %e secs..." python raytracing.py 1
rendered in 8.36 secs...
smith@wesson:~$ /usr/bin/time -f "\trendered in %e secs..." python raytracing.py 2
rendered in 10.82 secs...
smith@wesson:~$ /usr/bin/time -f "\trendered in %e secs..." python raytracing.py 3
rendered in 13.30 secs...
smith@wesson:~$ /usr/bin/time -f "\trendered in %e secs..." python raytracing.py 4
rendered in 13.40 secs...
import sys
import numpy as np
import matplotlib.pyplot as plt
w = 400
h = 300
def normalize(x):
x /= np.linalg.norm(x)
return x
smith@wesson:~$ python callMC.py 100000
Call price: 39.1021
smith@wesson:~$ python callMC.py 1000000
Call price: 38.8676
smith@wesson:~$ python callMC.py 10000000
Call price: 38.8956
smith@wesson:~$ python callMc.py 100000
3.112
smith@wesson:~$ python piMc.py 2 1000000
3.128
import sys
from random import gauss
from math import exp, sqrt
S_0 = 863.00 # underlying spot price
sigma = 0.20 # volatility of 20.00%
r = 0.0118 # risk free rate of 1.18%
T = 100/365.0 # maturity in 100 days
K = 860.00 # strike
paths = int(sys.argv[1])
>>> y[0]
0.0
>>>X[0].reshape((28,28))
array([[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 159, 253, 159, 50, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 238, 252, 252, 252, 237, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 227, 253, 252,
1> (n_neighbors: 2 , weigths: distance)
0> (n_neighbors: 2 , weigths: uniform)
2> (n_neighbors: 3 , weigths: uniform)
3> (n_neighbors: 3 , weigths: distance)
0> Training set score: 0.994200
1> Training set score: 1.000000
2> Training set score: 0.995274
3> Training set score: 1.000000
1> Test set score: 0.999785
0> Test set score: 0.993986
import qarnot
conn = qarnot.connection.Connection(client_token='<YOUR_API_TOKEN>')
task = conn.create_task('mnist-digitRecognition', 'docker-network', 4)
d = conn.create_disk('disk')
d.add_file('mnist_knn2.py')
task.resources.append(d)
task.constants['DOCKER_REPO'] = 'buildo/docker-python2.7-scikit-learn'
task.constants['DOCKER_CMD'] = 'python mnist_knn2.py ${FRAME_ID}'
task.run()