Skip to content

Instantly share code, notes, and snippets.

@x-yuri
x-yuri / bash: interrupting commands with async subprocesses when job control is disabled.md
Created July 1, 2024 12:54
bash: interrupting commands with async subprocesses when job control is disabled
@x-yuri
x-yuri / bash: interrupting commands with async subprocesses when job control is disabled.md
Last active July 2, 2024 01:26
bash: interrupting commands with async subprocesses when job control is disabled

bash: interrupting commands with async subprocesses when job control is disabled

See [the new gist][d].

bash allows to override SIGINT in async subprocesses when job control is disabled since 4.3:

$ bash -c 'sleep 10 & wait'
$ ps -eHo pid,ppid,pgid,stat,ignored,args
    PID    PPID    PGID STAT          IGNORED COMMAND
@x-yuri
x-yuri / bash: interrupting async subprocesses.md
Last active July 2, 2024 03:08
bash: interrupting async subprocesses

bash: interrupting async subprocesses

a.sh:

trap - INT
while true; do
    echo -n .
    sleep 2
done
@x-yuri
x-yuri / docker compose: depends_on.md
Created June 27, 2024 09:22
docker compose: depends_on

docker compose: depends_on

docker-compose.yml:

services:
  proxy:
    image: alpine:3.20
    command: sh -euc 'cd app; exec ./a.out'
    # command: sh -euc 'cd app; sleep 3; exec ./a.out'
@x-yuri
x-yuri / haproxy + docker.md
Last active June 27, 2024 16:46
haproxy + docker

haproxy + docker

docker-compose.yml:

services:
  haproxy:
    image: haproxy:2.9-alpine
    ports:
      - 8888:80
@x-yuri
x-yuri / rmagick: docker.md
Created June 24, 2024 04:16
rmagick: docker

rmagick: docker

Dockerfile:

FROM ruby:2.3.8-alpine3.8 AS gems
ARG V
RUN apk add build-base imagemagick6-dev \
    && gem install rmagick -v "$V"
@x-yuri
x-yuri / bower: CERT_HAS_EXPIRED.md
Last active June 24, 2024 01:25
bower: CERT_HAS_EXPIRED

bower: CERT_HAS_EXPIRED

$ docker run --rm alpine:3.8 sh -euxc '
    apk add npm git
    npm i -g bower
    echo "{\"allow-root\": true}" > .bowerrc
    echo "{\"name\": \"whatever\", \"dependencies\": {\"underscore\": \"latest\"}}" > bower.json
    bower install
'
@x-yuri
x-yuri / Let's Encrypt and Alpine Linux <= 3.8.md
Last active June 24, 2024 01:26
Let's Encrypt and Alpine Linux <= 3.8

Let's Encrypt and Alpine Linux <= 3.8

Alpine Linux contains now expired [DST Root CA X3][a] certificate:

$ docker run --rm alpine:3.8 sh -euxc '
    grep "### Digital Signature Trust Co." -A 21 /etc/ssl/cert.pem
'
+ grep '### Digital Signature Trust Co.' -A 21 /etc/ssl/cert.pem
### Digital Signature Trust Co.
@x-yuri
x-yuri / alpine linux <= 3.8: let's encrypt certs doesn't work.md
Last active June 24, 2024 01:02
alpine linux <= 3.8: let's encrypt certs doesn't work

Alpine Linux <= 3.8: Let's Encrypt certs doesn't work

See this.

a.js:

const https = require('https');
https.get({host: 'registry.bower.io'}, res => {
    console.log(res.statusCode);
@x-yuri
x-yuri / Displaying an ssl certificate from a commit.md
Last active June 21, 2024 00:10
Displaying an ssl certificate from a commit

Displaying an ssl certificate from a commit

a.awk:

/BEGIN/ {
    close(cmd);
    getline cn < "/tmp/cn";
    close("/tmp/cn")
    if (cn == "DST Root CA X3") {