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
""" | |
... 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 |
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/sh | |
export USER=ndaidong | |
export GIT_NAME='Dong Nguyen' | |
export GIT_EMAIL='[email protected]' | |
export PYTHON_VERSION=3.6.5 | |
export PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz |
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/sh | |
export SWAP_SIZE=2G | |
sudo fallocate -l $SWAP_SIZE /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo bash -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab' |
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 | |
export NODE_VERSION=8.10.0 | |
export NODE_DOWNLOAD_URL=https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.gz | |
wget "$NODE_DOWNLOAD_URL" -O node.tar.gz | |
tar -zxvf node.tar.gz | |
cd node-v$NODE_VERSION | |
./configure | |
make | |
sudo make install |
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 | |
export PYTHON_VERSION=3.6.5 | |
export PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz | |
sudo apt update | |
sudo apt install --no-install-recommends -y \ | |
software-properties-common build-essential \ | |
libssl-dev libreadline-dev libbz2-dev libsqlite3-dev zlib1g-dev \ | |
python-minimal |
NewerOlder