gcloud compute instances stop <your compute engine instance name>gcloud compute disks resize <your compute engine name/disk name> --zone <your compute engine zone> --size 30GB
| # for grayscale pdf | |
| gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dPDFSETTINGS=/ebook -dDownsampleColorImages=true -dColorImageResolution=144 -dDownsampleGrayImages=true -dGrayImageResolution=144 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=cvttranscript.pdf transcripts.pdf | |
| # for colored one | |
| gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dDownsampleColorImages=true -dColorImageResolution=144 -dDownsampleGrayImages=true -dGrayImageResolution=144 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=converted.pdf original.pdf |
| Install and Convert Jupyter Notebooks to PDF | |
| This Gist provides a step-by-step guide to installing the necessary tools for converting Jupyter Notebooks (.ipynb) to PDF format using Python. It covers installing the required packages and tools (pip, nbconvert, notebook-as-pdf, pyppeteer, and playwright), and includes commands to convert notebooks either in bulk or individually to PDF format using the webpdf exporter. | |
| Steps included: | |
| 1. Upgrade pip. | |
| 2. Install notebook-as-pdf and nbconvert. | |
| 3. Install pyppeteer and playwright for PDF rendering. | |
| 4. Convert all .ipynb files in a directory or a single notebook file to PDF. | |
| from google.cloud import bigquery | |
| import google.auth | |
| class BigQuerySchema: | |
| def __init__(self): | |
| self.schema = [] | |
| def add_fields(self, fields): | |
| for name, field_type in fields.items(): |
| import pandas as pd | |
| import numpy as np | |
| import plotly.express as px | |
| from sklearn.decomposition import PCA | |
| from sklearn.cluster import KMeans | |
| # Load data | |
| df = pd.read_pickle('all_user_embd-allmpnet.pickle') | |
| # Feature engineering |
| import pandas as pd | |
| from google.auth import default | |
| # Get default credentials and project ID | |
| credentials, project_id = default() | |
| def read_bigquery_table(query, use_bq_storage_api=True): | |
| # Read a table from BigQuery using the BigQuery Storage API |
Create a New Branch: Use the following command to create a new branch. Replace with the name you want for your new branch.
git checkout --orphan <branch-name>This will create a new branch with no commit history or files from the previous branch.
Remove Existing Files: Although the branch is empty, there might be untracked files left from the previous branch. To remove all these untracked files, use the following commands
| gsutil ls gs://gen-app-src/ | head -n 2000 | xargs -I '{}' gsutil cp '{}' gs://gen-app-dst/ |
| import numpy as np | |
| a = df.iloc[:, 0].values | |
| b = df.iloc[:, 1].values | |
| # Find the indices of matching elements | |
| matches = np.where(a == b) | |
| # Compare the indices across the two arrays | |
| for index in matches[0]: | |
| if a[index] == b[index]: |