Skip to content

Instantly share code, notes, and snippets.

View winter-code's full-sized avatar
💭
Debugging. Like really.

Arpana Mehta winter-code

💭
Debugging. Like really.
View GitHub Profile
@winter-code
winter-code / steps-to-generate-mfit-report.md
Last active August 10, 2022 19:39
Generating mFit report - JSON

Ssh into the machine we have the application to be analyzed.

gcloud compute ssh <machine_name> - tunnel-through-iap

Create a directory m4a and cd into it.

mkdir m4a && cd m4a

Download the latest version of the mfit assessment tool.

curl -O "https://mfit-release.storage.googleapis.com/$(curl -s https://mfit-release.storage.googleapis.com/latest)/mfit"

Make it executable.

@winter-code
winter-code / running_python2_script.py
Last active September 17, 2021 15:45
Converting plain textual files to JSONL format
# python2 <script> gs://<path_to_src_pdf> gs://<dest_bucket>/
# Converting one text file to JSONL format
# File name: src.pdf | GCS path for file: gs://test-bucket-for-automl-nlp/src.pdf
python2 input_helper_v2.py gs://test-bucket-for-automl-nlp/src.pdf gs://test-bucket-for-automl-nlp/
# Converting multiple text files with same extension to JSONL format
# File extension: *.pdf | GCS path for files: gs://test-bucket-for-automl-nlp/*.pdf
python2 input_helper_v2.py gs://test-bucket-for-automl-nlp/*.pdf gs://test-bucket-for-automl-nlp/
@winter-code
winter-code / pages.py
Last active August 9, 2021 15:20
Using page iterators to retrieve all data points
#Project details
from google.cloud import monitoring_v3
import time
client = monitoring_v3.MetricServiceClient()
project = 'project_id' #insert your project id
project_name = f"projects/{project}"
@winter-code
winter-code / list_time_series.py
Last active May 18, 2023 12:18
Plotting time series data fetched from google-cloud-monitoring APIs
#Project details
from google.cloud import monitoring_v3
import matplotlib.pyplot as plt # matplotlib imports needed only in case you want to plot the `points`
import matplotlib.dates as mdates
import time
client = monitoring_v3.MetricServiceClient()
@winter-code
winter-code / create_time_series.py
Last active July 26, 2021 07:47
Writing metric data to custom metrics on gcp monitoring dashboards
from google.cloud import monitoring_v3
import time
client = monitoring_v3.MetricServiceClient()
project_id = 'your-project-id' #TODO: Replace with yours
project_name = f"projects/{project_id}"
series = monitoring_v3.TimeSeries()
series.metric.type = "custom.googleapis.com/my_metric"
@winter-code
winter-code / create_custom_metric.py
Last active January 20, 2024 14:09
creating a custom monitoring metric on gcp
from google.api import label_pb2 as ga_label
from google.api import metric_pb2 as ga_metric
from google.cloud import monitoring_v3
client = monitoring_v3.MetricServiceClient()
project_name = f"projects/arpanas-project"
descriptor = ga_metric.MetricDescriptor()
descriptor.type = "custom.googleapis.com/my_metric"
descriptor.metric_kind = ga_metric.MetricDescriptor.MetricKind.GAUGE
descriptor.value_type = ga_metric.MetricDescriptor.ValueType.DOUBLE