Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♀️

Steren steren

🏃‍♀️
View GitHub Profile
@steren
steren / function.js
Created Aug 19, 2022
Firestore in Cloud Functions
View function.js
const {Firestore} = require('@google-cloud/firestore');
const firestore = new Firestore();
exports.helloWorld = async (req, res) => {
const document = firestore.doc('users/steren');
const doc = await document.get();
console.log('Read the document');
res.status(200).send('Hey');
};
@steren
steren / enable-fb-hosting-cloud-run.sh
Last active Mar 26, 2022
Set up Firebase Hosting in front of a Cloud Run service
View enable-fb-hosting-cloud-run.sh
#!/bin/bash
# Set up Firebase Hosting in front of a Cloud Run service, without using the firebase CLI
# The following commands must be installed:
# - gcloud
# - curl
# - jq
# Update these variables
PROJECT_ID="enable-fb-hosting" # Make sure you have enabled Firebase on this Google Cloud project
@steren
steren / chunked.go
Created Jul 7, 2020
Transfer-Encoding: chunked
View chunked.go
package main
import (
//"bytes"
//"io/ioutil"
"fmt"
"io"
"log"
"net/http"
"os"
@steren
steren / sterenfr.svg
Created May 6, 2020
steren.fr as SVG (printed as PDF then converted to SVG)
View sterenfr.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View secret-santa-principle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@steren
steren / cloudbuild.yaml
Created Aug 10, 2019
Use Cloud Build for arbitrary container execution (in this case, run ffmpeg)
View cloudbuild.yaml
steps:
- name: 'jrottenberg/ffmpeg'
args: ['-i', 'input.mp4', 'output.avi']
artifacts:
objects:
location: 'gs://steren-test-oneshot/'
paths: ['output.avi']
@steren
steren / loadtest.sh
Last active Mar 31, 2019
Send load to URL
View loadtest.sh
# Read docs at https://artillery.io/docs/cli-reference/#quick
npx artillery quick --rate 1 --duration 20 https://myapp.dev
@steren
steren / curl.sh
Last active Apr 16, 2021
Query GCP metadata server
View curl.sh
$ curl -H "Metadata-Flavor:Google" http://metadata.google.internal/computeMetadata/v1/project/project-id
@steren
steren / package.json
Last active Apr 2, 2020
TypeScript to JS
View package.json
{
"name": "hello-ts",
"version": "1.0.0",
"description": "Hello TS",
"scripts": {
"start": "node server.js",
"gcp-build": "npm run build",
"build": "tsc server.ts"
},
"author": "Steren <steren@google.com>",
@steren
steren / Dockerfile
Last active Sep 24, 2018
Function to generate traffic for a minute on a given URL
View Dockerfile
FROM node:8
WORKDIR /usr/src/app
COPY package*.json ./
ENV NODE_ENV=production
RUN npm install --production
COPY . .
CMD [ "npm", "start" ]