Skip to content

Instantly share code, notes, and snippets.

  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"`
@nikolaydubina
nikolaydubina / git_commit_ollama.sh
Last active November 20, 2024 04:49 — forked from karpathy/add_to_zshrc.sh
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# based on https://gist.github.com/karpathy/1dd0294ef9567971c1e4348a90d69285
gcm() {
# Function to generate commit message
// https://jameshfisher.com/2018/02/20/c-inline-assembly-hello-world/
int main(void) {
register int syscall_no asm("rax") = 1;
register int arg1 asm("rdi") = 1;
register char* arg2 asm("rsi") = "hello, world!\n";
register int arg3 asm("rdx") = 14;
asm("syscall");
return 0;
}
// https://go.dev/play/p/HTKZzENHPcG
package main
import (
"encoding/json"
"fmt"
)
type Color struct{ c uint }

Why browsers do not send If-None-Match for caching images? Why browser does not try to get 304 status code for caching?

This can be because there are video html that is trying to load at same time. This can break some browser behavior that will not even attempt to use cached images for some reason. Make preload="none" for videos to stop loading them, and then browser will attempt to use etags for images. Add Cache Control: public. This will make Safari to attempt If-None-Match and make 304 requetsts. private should also work.

2024-04-23

// https://go.dev/play/p/1nLXyCDe1_3
// because UNIX! 🐣
package main
import "fmt"
var (
Read = Permission{0x1}
Write = Permission{0x2}
Execute = Permission{0x4}
// 🍧
package main
import "fmt"
type LRUCache struct {
size int
vals map[string]string
order PtrList
}

Convert to CSV

jq -r '[.function_name, .call_count] | @csv'