[TOC]
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import DataFrame, Series| from selenium.common.exceptions import NoSuchElementException, ElementClickInterceptedException | |
| from selenium import webdriver | |
| import time | |
| import pandas as pd | |
| def get_jobs(keyword, num_jobs, verbose): | |
| '''Gathers jobs as a dataframe, scraped from Glassdoor''' | |
| # Initializing the webdriver |
| """ | |
| Single Responsibility Principle | |
| “…You had one job” — Loki to Skurge in Thor: Ragnarok | |
| A class should have only one job. | |
| If a class has more than one responsibility, it becomes coupled. | |
| A change to one responsibility results to modification of the other responsibility. | |
| """ | |
| class Animal: | |
| def __init__(self, name: str): |
How to get an estimate of the impact of writing Postgres logs with log_min_duration_statement = 0:
Do select pg_stat_statements_reset(); and wait N seconds (where N >> 60 – say 1-24 hours, covering typical busy hours). Remember when it was, and write down somewhere – this timestamp will be needed!
Check if select count(*) from pg_stat_statements is lower than pg_stat_statements.max. If it's equal to it, then raise pg_stat_statements.max and restart with the step 1.
Get the estimate:
\set TS_PGSS_RESET 'XXXX-XX-XX XX:XX:XX';| -- | |
| -- ** setting up example tables and data ** | |
| -- | |
| -- | |
| CREATE TABLE task ( | |
| id BIGSERIAL , | |
| name TEXT, | |
| parent_id BIGINT REFERENCES task(id), | |
| PRIMARY KEY (id) |
| [pytest] | |
| log_cli = true | |
| log_cli_date_format = %H:%M:%S | |
| log_cli_format = %(asctime)s.%(msecs)03d %(levelname)-8s %(name)-32s %(threadName)-12s %(message)s | |
| addopts = --quiet --showlocals --tb=short |
| #Code from http://fmota.eu/, great! | |
| class Monoid: | |
| def __init__(self, null, lift, op): | |
| self.null = null | |
| self.lift = lift | |
| self.op = op | |
| def fold(self, xs): | |
| if hasattr(xs, "__fold__"): | |
| return xs.__fold__(self) |
| from rasa_nlu.training_data import load_data | |
| # This re-uses the Rasa NLU converters code to turn a JSON Rasa NLU training | |
| # file into MD format and save it | |
| # Assumes you have Rasa NLU installed :-) | |
| # If you want other options, look at the NLU code to work out how to handle them | |
| # USE AT YOUR OWN RISK |
Using ssh Command:
# sudo only necessary to bind to protected port such as 80 or 443
sudo gcloud compute ssh <instance_name> -- -N -L 80:localhost:80Using start-iap-tunnel Command
# sudo only necessary to bind to protected port such as 80 or 443
sudo gcloud compute start-iap-tunnel 80 --local-host-port=localhost:80