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
import pyautogui | |
import time | |
#enable accssibilty permssion to terminal | |
#first get the position to click. | |
# pos = pyautogui.position() | |
# print(pos) | |
# x=1388, y=667 | |
while True: | |
pyautogui.moveTo(1372, 670) # move mouse to the window | |
pyautogui.dragTo(1372, 670, button = 'left') # focus the window |
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
import logging | |
logger = logging.getLogger('name') | |
logger.setLevel(logging.DEBUG) | |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
# create file handler which logs even debug messages | |
fh = logging.FileHandler('name.log') | |
fh.setLevel(logging.WARNING) | |
fh.setFormatter(formatter) | |
logger.addHandler(fh) |
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
> on the local server do the following: | |
mkdir ~.ssh | |
chmod 750 ~ | |
chmod 700 ~/.ssh | |
ssh-keygen -t rsa -b 2048 | |
cat id_rsa_<server_name>.pub | |
> On the remote server do the following: | |
mkdir ~.ssh | |
chmod 750 ~ |
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
import redis | |
import time | |
import sys | |
def producer(): | |
r = redis.Redis() | |
i = 0 | |
while True: | |
r.rpush('queue', 'Message %d' % i) |
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
sudo apt-get install libpq-dev postgresql postgresql-contrib | |
sudo -u postgres -i | |
psql | |
create database tagger; | |
create user tagger_user with password 'passsss'; | |
grant all privileges on database tagger to tagger_user; | |
ALTER ROLE tagger_user SET client_encoding TO 'utf8'; | |
ALTER ROLE tagger_user SET default_transaction_isolation TO 'read committed'; | |
ALTER ROLE tagger_user SET timezone TO 'UTC'; | |
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
sudo apt install --reinstall python-debian python3-debian python-chardet python3-chardet |
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
import logging | |
app = Flask(__name__) | |
# gunicorn_error_logger = logging.getLogger('gunicorn.error') | |
# app.logger.handlers.extend(gunicorn_error_logger.handlers) | |
# app.logger.setLevel(logging.DEBUG) | |
# app.logger.debug('this will show in the log') | |
# gunicorn_logger = logging.getLogger(‘gunicorn.error’) |
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
import glob | |
import os | |
from PIL import Image | |
import concurrent.futures | |
def make_image_thumbnail(filename): | |
# The thumbnail will be named "<original_filename>_thumbnail.jpg" | |
base_filename, file_extension = os.path.splitext(filename) | |
thumbnail_filename = f"{base_filename}_thumbnail{file_extension}" |
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
import logging | |
import logging.handlers as handlers | |
import time | |
logger = logging.getLogger('my_app') | |
logger.setLevel(logging.INFO) | |
# Here we define our formatter | |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
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
gcloud auth configure-docker | |
#gcloud project name - deeplearning-181416 | |
#local image name - eminn/grafana-dashboard | |
#grafane-image is image and v1 is the tag | |
docker tag eminn/grafana-dashboard gcr.io/deeplearning-181416/grafane-image:v1 | |
docker push gcr.io/deeplearning-181416/grafane-image:v1 |
NewerOlder