This talk is all live demos of tools developers can use in their inner-loop, at development time to be more productive with containers.
Docker Compose captures the build arguments and run arguments so we can focus on our coding.
struct Draft {} | |
struct PendingReview {} | |
struct Published {} | |
struct Post { | |
state: Option<Box<dyn State>>, | |
content: String, | |
} | |
// self: Box<Self> "This syntax means the method is only valid when called on a Box holding the type." | |
trait State { |
FROM jenkins/jenkins:2.331-jdk11 | |
USER root | |
RUN apt-get update && apt-get install -y lsb-release zip unzip | |
RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \ | |
https://download.docker.com/linux/debian/gpg | |
RUN echo "deb [arch=$(dpkg --print-architecture) \ | |
signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \ | |
https://download.docker.com/linux/debian \ | |
$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list | |
RUN apt-get update && apt-get install -y docker-ce-cli |
version: "2" | |
services: | |
zookeeper: | |
image: docker.io/bitnami/zookeeper:3.7 | |
networks: | |
- kiko | |
ports: | |
- "2181:2181" | |
volumes: |
package main | |
import ( | |
"fmt" | |
"github.com/jinzhu/gorm" | |
_ "github.com/lib/pq" | |
) | |
func main() { |
web: | |
image: 'gitlab/gitlab-ce:latest' | |
restart: always | |
hostname: 'git.dongnguyen.dev' | |
environment: | |
GITLAB_OMNIBUS_CONFIG: | | |
external_url 'https://git.dongnguyen.dev' | |
nginx['listen_port'] = 80 | |
nginx['listen_https'] = false | |
gitlab_rails['gitlab_shell_ssh_port'] = 24 |
[Unit] | |
Description=Setup a secure tunnel | |
After=network.target | |
[Service] | |
ExecStart=/usr/bin/ssh -NT -v -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -i /home/dong/key.pem -R 0.0.0.0:22:localhost:22 dong@dongnguyen.dev | |
# Remote Burst, restart to die | |
StartLimitBurst=500000 | |
StartLimitIntervalSec=10000 |
# Golang - Building Executables for Different Architectures | |
env GOOS=**target-OS** GOARCH=**target-architecture** go build **package-import-path** | |
```sh | |
# Example | |
env GOOS=darwin GOARCH=amd64 go build | |
env GOOS=darwin GOARCH=amd64 go build main.go | |
env GOOS=darwin GOARCH=amd64 go build github.com/zoo/york/foo/bar |
# Performing UDP tunneling through an SSH connection | |
------ | |
## Intro | |
The Swiss ISP [Bluewin](http://www.bluewin.ch/) sucks. Their DNS are often down. A friend even received advice from Bluewin technicians to not use their own DNS!... But then, it is quite hard to gain access to another DNS for free, if you don't have access to a co hosted machine. | |
In this document, we'll access another machine's network internal DNS services (UDP port 53) with only SSH access to it. We will forward local UDP/53 traffic to TCP, then TCP traffic with the port-forwarding mechanism of SSH to the other machine, then TCP to UDP/53 on the other end. Typically, you can do it with [openvpn](http://openvpn.net/). But here, we'll do it with simpler tools, only [openssh](http://www.openssh.com/) and [netcat](http://m.nu/program/util/netcat/netcat.html). |
const { Pool } = require("pg"); | |
const connectionString = process.env.db_uri || "postgres://localhost:5432/postgres"; | |
const pool = new Pool({ connectionString }); | |
function Locker(key, timeout, retryCount) { | |
this.key = key; | |
this.timeout = timeout || 200; | |
this.retryCount = retryCount || 5; | |
this.getClient = getClient; | |
this.aquireLock = aquireLock; |