Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Höltje docwhat

View GitHub Profile
View go.mod
module gist.github.com/e3b13265d24471651e02f7d7a42e7d2c
go 1.18
@docwhat
docwhat / symlink-checker-tests.bash
Created Jun 27, 2022
Ways of checking if a file is "a symlink" and is "broken".
View symlink-checker-tests.bash
@docwhat
docwhat / update.bash
Created Jun 10, 2022
Script to update MiniUI for the Miyoo Mini
View update.bash
#!/bin/zsh
set -eu
cd "${0:h}"
die() {
echo "death: $*" >&2
exit
}
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 = [:]