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 |
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
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
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
FROM python:3.8-buster | |
ENV PYTHONUNBUFFERED=1 | |
RUN mkdir -p /src/app/ | |
WORKDIR /src | |
ADD requirements.txt /src/requirements.txt | |
RUN pip install -r requirements.txt |
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: | |
nginx-proxy: | |
container_name: nginx-proxy | |
image: jwilder/nginx-proxy | |
environment: | |
- ENABLE_IPV6=true | |
ports: | |
- "80:80" |
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
""" | |
... some code | |
""" | |
import socket | |
HOSTNAME=socket.gethostname() | |
""" | |
... some more code |
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
ALL | |
All messages in the mailbox; the default initial key for | |
ANDing. | |
ANSWERED | |
Messages with the \Answered flag set. | |
BCC | |
Messages that contain the specified string in the envelope | |
structure's BCC field. |
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
#!/usr/bin/env python | |
# | |
# Very basic example of using Python and IMAP to iterate over emails in a | |
# gmail folder/label. This code is released into the public domain. | |
# | |
# RKI July 2013 | |
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/ | |
# | |
import sys | |
import imaplib |
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
#!/bin/bash | |
add-apt-repository ppa:jonathonf/python-3.6 && apt-get update | |
apt-get install -y python3.6 |
NewerOlder