Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Höltje docwhat

View GitHub Profile
View .editorconfig
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@docwhat
docwhat / README.md
Last active Feb 18, 2021
Running docker locally
View README.md
docker network create jenkins
docker run \
  --detach \
  --rm \
  --net=jenkins \
  --volume=jenkins_home:/var/jenkins_home:rw \
  --volume=/var/run/docker.sock:/var/run/docker.sock:rw \
  --publish=8080:8080 \
  --env=JAVA_OPTS=-DexecutableWar.jetty.sessionIdCookieName=dockerjenkins \
@docwhat
docwhat / Makefile
Created Jan 30, 2021
Playing with clang and assembly
View Makefile
default: hello hello-asm
hello-asm.s: hello.c
clang -S -masm=intel -o $@ $<
%: %.s
clang -o $@ $<
%: %.o
clang -o $@ $<
@docwhat
docwhat / cwd.c
Last active Jan 22, 2021
macOS program to get current working directory of any PID.
View cwd.c
#include <errno.h>
#include <libproc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Works on macOS using libproc.
int main(int argc, char *argv[]) {
int ret;
@docwhat
docwhat / Dockerfile
Created Aug 20, 2020
Example of mounting one stage from another
View Dockerfile
# syntax=docker/dockerfile:1-experimental
FROM alpine:3 AS fetcher
# We don't care about minimizing the number layers for this image.
RUN apk add --no-cache curl ca-certificates
WORKDIR /files
RUN curl -sSLf -o chronic https://github.com/docwhat/chronic/releases/download/v1.0.11/chronic_linux_amd64
@docwhat
docwhat / custom_404.html
Last active Jun 26, 2020
HTML error single pages
View custom_404.html
<!DOCTYPE html>
<html>
<head>
<title>Canvas Asteroids</title>
<style>
* {
margin: 0;
}
canvas {
@docwhat
docwhat / profiling.groovy
Last active Feb 7, 2020
In Groovy profiling
View profiling.groovy
#!/usr/bin/env groovy
// This works in Jenkinsfiles without approving any scripts.
class MyProfiler {
def timings
def dsl
MyProfiler(dsl) {
this.timings = [:]
@docwhat
docwhat / catalina.md
Last active Oct 23, 2019
Security issues on macOS Cataline for command line users
View catalina.md

NOTE: The latest version is at https://docwhat.org/upgrading-to-catalina

For those upgrading to macOS Catalina!

To allow running programs, go to the “Security & Privacy” system preference, click on the “Privacy” tab, scroll down to “Developer Tools” and add (and check) all the terminal programs you use.

Example(s):

  • Terminal.app (comes with macOS).
  • iTerm.app
View k3s-example.md
$ uname -a
Darwin bluewhat.local 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64
$ k3d create --workers=2 --image=docker.io/rancher/k3s:v0.9.1
INFO[0000] Created cluster network with ID 0b01d65880241866f5e80968477ef60340b2abe408585e907e9755d1580375b1
INFO[0000] Created docker volume  k3d-k3s-default-images
INFO[0000] Creating cluster [k3s-default]
INFO[0000] Creating server using docker.io/rancher/k3s:v0.9.1...
INFO[0000] Booting 2 workers for cluster k3s-default
INFO[0001] Created worker with ID 739ef6c7ac4062bbc00159d4cb03648ba64e3b0ab06e41e0070815a709b26f83
@docwhat
docwhat / build.bash
Created Aug 16, 2019
Build a docker image with bash
View build.bash
#!/bin/bash
set -eu
cmd=
cname=bob
colour() {
tput bold
tput smso