This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void deviceQuery () | |
{ | |
cudaDeviceProp prop; | |
int nDevices=0, i; | |
cudaError_t ierr; | |
ierr = cudaGetDeviceCount(&nDevices); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pair: | |
def __init__(self, key, value): | |
self.key = key | |
self.value = value | |
def __str__(self): | |
return "({}, {})".format(str(self.key), str(self.value)) | |
def __repr__(self): | |
return self.__str__() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from skimage.draw import (line, polygon, circle, | |
circle_perimeter, | |
ellipse, ellipse_perimeter, | |
bezier_curve) | |
# Draw a rectangle | |
img = np.ones((10, 10), dtype=np.double) # a gray image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import matplotlib.patches as mpatches | |
from skimage import data | |
# get image | |
img = data.astronaut() | |
print('image size', img.shape) | |
fig, ax = plt.subplots() | |
ax.imshow(img) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modified from http://scikit-image.org/docs/stable/auto_examples/transform/plot_pyramid.html#sphx-glr-auto-examples-transform-plot-pyramid-py | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from skimage import data | |
from skimage.transform import pyramid_gaussian | |
image = data.astronaut() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = boto3.client('ec2') | |
instance_id = 'my instance id' | |
def rotate_ip(last_eip=None): | |
if last_eip: | |
client.release_address(AllocationId=last_eip['AllocationId']) | |
eip = client.allocate_address(Domain='vpc') | |
r = client.associate_address(AllocationId=eip['AllocationId'], InstanceId=instance_id) | |
return eip |
NewerOlder