Skip to content

Instantly share code, notes, and snippets.

View Deleplace's full-sized avatar

Valentin Deleplace Deleplace

View GitHub Profile
@Deleplace
Deleplace / helloworld.go
Created November 26, 2018 12:57
Trace for AppEngine Standard with Go 1.11 (can't deploy as of 2018-11-26)
// Copyright 2018 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// [START gae_go111_app]
// Sample helloworld is an App Engine app.
package main
// [START import]
package datastorekey
import (
"testing"
"cloud.google.com/go/datastore"
)
func TestDocBug(t *testing.T) {
URLsafeKey := "ahRzfnByb2dyYW1taW5nLWlkaW9tc3IMCxIFSWRpb20YmgEM"
@Deleplace
Deleplace / signdance.go
Last active January 25, 2019 09:20
A command-line program to generate a dancing gopher GIF
# Copyright 2019 Google LLC
# SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/gif"
@Deleplace
Deleplace / signdance.go
Last active January 26, 2019 20:28
Source code for a sample Google Cloud Function
# Copyright 2019 Google LLC
# SPDX-License-Identifier: Apache-2.0
package p
import (
"fmt"
"image"
"image/color"
"image/draw"
"image/gif"
@Deleplace
Deleplace / sequential.go
Created February 14, 2019 23:56
A Google Cloud Function that fetches 10 remote resources sequentially
package p
import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"sync"
"time"
@Deleplace
Deleplace / concurrent.go
Created February 14, 2019 23:57
A Google Cloud Function that fetches 10 remote resources concurrently
package p
import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"sync"
"time"
@Deleplace
Deleplace / gist:b8ab1638c7b9cae352f94012c468e1ec
Last active April 18, 2019 10:49
My GCP shortcut list (search engines) for Chrome
GCP console
gcp
https://console.cloud.google.com
Cloud Storage
gcs
https://console.cloud.google.com/storage/browser
@Deleplace
Deleplace / slowdownserver.go
Created July 23, 2019 14:28
Server having a period of freeze or extreme slowness. See https://youtu.be/lJ8ydIuPFeU?t=1274
// Copyright 2019 Google LLC
// SPDX-License-Identifier: Apache-2.0
package main
import (
"fmt"
"log"
"net/http"
"sync"
"time"
@Deleplace
Deleplace / programming-idioms.org.2019-09-28_23-33.json
Created September 28, 2019 23:38
Snapshot of the database of Programming Idioms
This file has been truncated, but you can view the full file.
[
{
"Id": 1,
"OrigId": 0,
"Title": "Print Hello World",
"LeadParagraph": "Print a literal string on standard output",
"ExtraKeywords": "",
"Author": "programming-idioms.org",
"CreationDate": "2016-02-18T16:57:54.865234Z",
"LastEditor": "ara",
@Deleplace
Deleplace / semgroup.go
Created November 4, 2019 14:17
Synchronization, error propagation, Context cancelation, and concurrency limiting for groups of goroutines working on subtasks of a common task.
package semgroup
import (
"context"
"golang.org/x/sync/errgroup"
)
// SemGroup is a thin wrapper for golang.org/x/sync/errgroup, with
// the extra capability of limiting the number of concurrent