Skip to content

Instantly share code, notes, and snippets.

View cyakimov's full-sized avatar
🏠
Working from home

Carlos Yakimov cyakimov

🏠
Working from home
  • Falabella
  • Santiago, Chile
View GitHub Profile
@cyakimov
cyakimov / build.sh
Created April 20, 2018 19:01 — forked from bobbytables/build.sh
Protocol Buffer build script for multiple folders
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}
@cyakimov
cyakimov / external.go
Created October 31, 2018 18:23 — forked from scholzj/external.go
SASL EXTERNAL in Go
package main
import (
"fmt"
"qpid.apache.org/electron"
"os"
"crypto/tls"
"io/ioutil"
"crypto/x509"
)
A good commit message looks like this:
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about

📂 Minimize allocations in Go

Working with protobuf in Go puts significant load on the memory subsystem, as protobuf-generated structures often contain a significant amount of pointers.

One way to minimize the number of allocations is to allocate all the fields at the same time, and then use internal pointers to wire them up.

Let's pretend you have (the generated Go code for) four messages A, B, C, and D (note: for clarity this is not really protobuf-generated code, but the technique

@cyakimov
cyakimov / restic_backup.sh
Created November 30, 2021 00:07 — forked from kennethso168/restic_backup.sh
My Backup Solution
#!/bin/bash
# Location of your restic repo
export RESTIC_REPOSITORY=/run/media/kenneth/MyBook/restic
# Password of the restic repo
# Use a keyring to store the password so it isn't stored in plaintext on disk
# Install python-keyring (Arch) to use this command
export RESTIC_PASSWORD=`keyring get restic MyBook`
if ! restic snapshots