import numpy as np
a = np.arange(1000)
a = a.reshape(2, 500)
a = a.resize((2,600), refcheck = False)
import numpy as np
from math import factorial
def sin(x):
val = np.float64(0)
for n in range(0, 25):
term = (((-1) ** n) * (x ** (2*n+1)) / factorial(2*n + 1))
val += term
print("for x_{0}, term is {1}, sin({2}) approximation is {3}".format(
n, term, x, val))
brew install python3
brew install apple-gcc42
brew unlink gcc
ln -sf /usr/local/bin/gfortran-4.2 /usr/local/bin/gfortran
#optional: create virtualenv
python3 -mvenv ~/venvs/my_venv
source ~/venvs/my_venv/bin/activate
#end optional
import re
p = re.compile('\"([^\"]+)\"')
str = 'I said "Hello There." She replied "hi"'
matches = p.findall(str)
for m in matches:
print('found: {0}'.format(m))
View main.cpp
#include <iostream>
#include <iomanip>
#include "math.h"
using namespace std;
float pmf(int k, double lambda) {
return pow(M_E, k * log(lambda) - lambda - lgamma(k + 1.0));
import boto
import boto.s3
from boto.s3.key import Key
from glob import glob
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-p","--pattern", help="pattern to upload")
args = parser.parse_args()
import numpy as np
import matplotlib.pyplot as plt
from math import pi, cos, sin
arc_size = pi / 2
points = 20
inner_ratio = .4
theta = np.arange(0, arc_size, arc_size / points)
View FixIcons.bat
# start cmd.exe as admin
# start taskmanager and close explorer.exe
cd %userprofile%\appdata\local
del iconcache.db /a
# start explorer.exe
sudo yum -y install epel-release
sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
# use pip or pip3 as you prefer for python or python3
pip install --upgrade virtualenv
virtualenv --system-site-packages ~/venvs/tensorflow
source ~/venvs/tensorflow/bin/activate
pip install --upgrade numpy scipy wheel cryptography #optional
pip install --upgrade
# or below if you want gpu, support, but cuda and cudnn are required, see docs for more install instructions
pip install --upgrade
View trig_functions.R
g <- qplot(c(0, 2 * pi), stat="function", fun=sin,
geom="line", color="sin", ylim=c(-2, 2),
ylab="ratio", xlab="radians") +
stat_function(fun=cos, aes(color="cos")) +
stat_function(fun=tan, aes(color="tan"))