Skip to content

Instantly share code, notes, and snippets.

View matti's full-sized avatar
🎯
Focusing

Matti Paksula matti

🎯
Focusing
View GitHub Profile

Beautiful Bash

until something is true

if "creation" command fails, sleep 1

while true; do
  kubectl get namespace mynamespace && break
 kubectl create namespace mynamespace || sleep 1
@matti
matti / pty_spawn_stderr_stdout.rb
Created June 23, 2017 08:14
Separates Ruby PTY spawn stderr from stdout
require "pty"
stderr_reader, stderr_writer = IO.pipe
args = ["-c", "read a; echo was: $a; echo err:$a >&2"]
stdout,stdin,pid = PTY.spawn("/bin/bash", *args, err: stderr_writer.fileno)
stderr_writer.close
stdin.puts "hello"