Skip to content

Instantly share code, notes, and snippets.

package main
import (
"context"
"encoding/json"
"flag"
"log"
"os"
"cloud.google.com/go/firestore"
package main
import (
"context"
"encoding/json"
"flag"
"log"
"os"
"cloud.google.com/go/firestore"
#!/bin/sh
cat Localizable.xcstrings | jq -r '
.strings
| to_entries[]
| [.key,
(.value.localizations."zh-Hans".stringUnit.value // ""),
(.value.localizations."zh-Hant".stringUnit.value // ""),
(.value.localizations.ja.stringUnit.value // ""),
(.value.localizations.ko.stringUnit.value // ""),

branch with current year and week number

git co -b "$(date +%Y-%W)"
#!/bin/sh
export PROJECT_ID=...
export LOCATION=us-central1
export OPENAI_API_KEY="$(gcloud auth application-default print-access-token)"
export MODEL_ID="google/gemini-2.5-flash"
export OPENAI_BASE_URL="https://${LOCATION}-aiplatform.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/${LOCATION}/endpoints/openapi"
echo $OPENAI_API_KEY
echo $MODEL_ID
<html>
<body>
<video id="player" autoplay muted playsinline></video>
<button id="capture">Capture</button>
<canvas id="canvas"></canvas>
<script>
const player = document.getElementById('player');
const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
const captureButton = document.getElementById('capture');
// when does Go fail to encode JSON?
// https://go.dev/play/p/5ptv2ifv8_7
package main
import (
"encoding/json"
"fmt"
"math"
)
  1. All teams will henceforth expose their data and functionality through service interfaces.
  2. Teams must communicate with each other through these interfaces.
  3. There will be no other form of interprocess communication allowed: no direct linking, no direct reads of another team’s data store, no shared-memory model, no back-doors whatsoever. The only communication allowed is via service interface calls over the network.
  4. It doesn’t matter what technology they use. HTTP, Corba, Pubsub, custom protocols — doesn’t matter.
  5. All service interfaces, without exception, must be designed from the ground up to be externalizable. That is to say, the team must plan and design to be able to expose the interface to developers in the outside world. No exceptions.
  6. Anyone who doesn’t do this will be fired.
  7. Thank you; have a nice day!
// yes
package main
import (
"encoding/json"
"fmt"
"time"
)
type S struct {
package main
import (
"encoding/base64"
"encoding/json"
"fmt"
)
type X struct {
B []byte `json:"b"`