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
| # Create first image as Builder | |
| FROM node:12.16.1-alpine As builder | |
| WORKDIR /usr/src/app | |
| COPY package.json package-lock.json ./ | |
| RUN npm install | |
| COPY . . |
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
| version: "2" | |
| services: | |
| plex: | |
| image: linuxserver/plex:latest | |
| container_name: plex | |
| network_mode: host | |
| environment: | |
| - PUID=127 # user id of plex user | |
| - PGID=130 # group id of plex user | |
| - VERSION=docker |
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
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
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 requests | |
| ... | |
| # Send REST request with Bearer OAuth2 token | |
| # run_service_url = The https endpoint created automatically by your new Cloud Run service | |
| # token = The response from the step above | |
| request = requests.get( | |
| url = run_service_url, |
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 requests | |
| import urllib | |
| ... | |
| # Exchange JWT token for a google-signed OIDC token | |
| # signed_jwt = Response/return value from previous step | |
| def exchange_jwt_for_token(signed_jwt): | |
| body = { |
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 time | |
| import jwt | |
| import urllib | |
| ... | |
| # Create and return a signed JWT token to the designated service endpoint | |
| # credentials_json = a Python dictionary created by loading your local service account credentials json file | |
| # run_service_url = The https endpoint created automatically by your new Cloud Run service |
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
| # ~/src/lib/utilities.py | |
| def concat_strings(a, b) | |
| new_string = str('{} {}'.format(a,b)) | |
| return new_string |
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 json | |
| import requests | |
| api_url = <YOUR FUNCTION HTTP URL> | |
| api_headers = { | |
| "Content-Type": "application/json" | |
| } | |
| api_data = { | |
| 'a': 'Stephen', | |
| 'b': 'Darling' |
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 | |
| def create_string(a,b): | |
| new_string = str("{}-{}".format(a,b)) | |
| # logging(...) | |
| logging.info('create_string(a,b): {}'.format({ | |
| 'arguments': { a,b }, | |
| 'result': new_string | |
| })) | |
| return new_string |
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
| const dataArray = [ | |
| { key: 1, value: 'c', name: 'celsius', toKelvin: ')+ 273.15', fromKelvin: ')- 273.15'}, | |
| { key: 2, value: 'f', name: 'fahrenheit', toKelvin: '+ 459.67) * 5/9', fromKelvin: ')* 9/5 - 459.67'}, | |
| { key: 3, value: 'r', name: 'rankine', toKelvin: ')*5/9', fromKelvin: ')* 9/5'}, | |
| { key: 4, value: 'k', name: 'kelvin', toKelvin: ')', fromKelvin: ')'} | |
| ] | |
| var performConvert = (t,fx) => eval('('+Number(t) + fx) | |
| var convert = (it,iu,tt,tu) => { |
NewerOlder