This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
Note: The code links are to CPython 3.8.5, the most recent release when this was written.
I was recently asked about a performance optimization in CPython around using +=
and +
for string objects.
As some people may already know, if you use +=
or +
a string, it can sometimes be just as fast as ''.join
.
The question was to explain when that optimization couldn't be performed.
We will be going through the following example scenarios:
Lets assume you have 3 managers and 3 workers on 17.06 and you want to update to 17.12
# Docker-in-Docker Gitlab runners setup taken from: | |
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca | |
dind: | |
restart: always | |
privileged: true | |
volumes: | |
- /var/lib/docker | |
image: docker:17.09.0-ce-dind | |
command: | |
- --storage-driver=overlay2 |
# ########################################################## # | |
# Makefile for Golang Project | |
# Includes cross-compiling, installation, cleanup | |
# ########################################################## # | |
# Check for required command tools to build or stop immediately | |
EXECUTABLES = git go find pwd | |
K := $(foreach exec,$(EXECUTABLES),\ | |
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH))) |
docker build -t $IMAGE_NAME - << EOF
FROM alpine:latest
...
EXPOSE 80
EOF
#!/bin/bash | |
name=$RANDOM | |
url='http://localhost:9093/api/v1/alerts' | |
echo "firing up alert $name" | |
# change url o | |
curl -XPOST $url -d "[{ | |
\"status\": \"firing\", |
#!/usr/bin/env bash | |
rep() { | |
i=$1 | |
data=$2 | |
## run the replicate .... | |
} | |
# make the files | |
START=$(mktemp -t start-XXXX) ## signals the workers are starting |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
# Single line of Ruby <3. | |
ruby -rjson -ryaml -e "puts YAML.load_file('my_file.yml').to_json" | |
# You can also pipe it to Python to get pretty ouput | |
ruby -rjson -ryaml -e "puts YAML.load_file('my_file.yml').to_json" | \ | |
python -mjson.tool | |
# Thats all. :) |