Skip to content

Instantly share code, notes, and snippets.

View steren's full-sized avatar

Steren steren

View GitHub Profile
View github-regexp.csv
We can't make this file beautiful and searchable because it's too large.
(?m)^hello world,338
steren / nginx.conf
Created November 3, 2022 23:59
nginx.conf with gzip enabled
View nginx.conf
server {
listen 8080;
server_name _;
gzip on;
location / {
steren / function.js
Created August 19, 2022 04:52
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');
steren /
Last active March 26, 2022 19:14
Set up Firebase Hosting in front of a Cloud Run service
# 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 / gist:1538982
Created December 30, 2011 09:35
Git: compare a local branch with upstream repository
View gist:1538982
git fetch upstream && git diff remotes/upstream/master master > changes.diff
steren /
Last active April 16, 2021 23:17
Query GCP metadata server
$ curl -H "Metadata-Flavor:Google"
steren /
Created November 3, 2010 10:22
Upload and store image with Play! Framework
public class Application extends Controller {
public static void index() {
public static void uploadPicture(Picture picture) {;
steren / regexp-github.sql
Last active July 13, 2020 17:49
Extract constant Go regular expressions from GitHub
View regexp-github.sql
# Extracts constant Go regular expressions from GitHub
# using BigQuery GitHub public dataset.
# To run on the entire GitHub corpus,
# remove the `sample_` prefix from the table names.
# Warning: This query processes ~2.2 TB of data, which is above BigQuery free quota.
REGEXP_EXTRACT(pattern, r'^[\"\`](.*)[\"\`]$') as pattern,
COUNT(*) AS cnt,
steren / chunked.go
Created July 7, 2020 03:52
Transfer-Encoding: chunked
View chunked.go
package main
import (
steren / balsamiq.svg
Created August 24, 2011 09:41
Balsmiq Mockup style made with Inkscape
View balsamiq.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.