This file contains 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
version: '3.2' | |
services: | |
agent: | |
image: portainer/agent:2.10.0 | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- /var/lib/docker/volumes:/var/lib/docker/volumes | |
networks: | |
- agent_network |
This file contains 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
keys_list = ['A', 'B', 'C'] | |
values_list = ['blue', 'red', 'bold'] | |
#There are 3 ways to convert these two lists into a dictionary | |
#1- Using Python's zip, dict functionz | |
dict_method_1 = dict(zip(keys_list, values_list)) | |
#2- Using the zip function with dictionary comprehensions | |
dict_method_2 = {key:value for key, value in zip(keys_list, values_list)} |
This file contains 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 ServiceProvider { | |
constructor(services) { | |
this._services = services; | |
// use proxy to create a "magic getter" that will search the _services for a matching name | |
// then call "_makeOnce" to instantiate or return the singleton | |
return new Proxy(this, { | |
get: (provider, service) => { | |
service = service.charAt(0).toUpperCase() + service.slice(1); |
This file contains 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
import numpy as np | |
import math | |
import cv2 | |
def rotate_image(image, angle): | |
image_center = tuple(np.array(image.shape[1::-1]) / 2) | |
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0) | |
result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR) | |
return result |
OlderNewer