Skip to content

Instantly share code, notes, and snippets.

@DanielThomas
DanielThomas / gradle-cache.vcl
Last active February 19, 2021 01:04
Varnish Cache Plus (Enterprise) configuration for Gradle HTTP Build Cache
vcl 4.1;
import purge;
import std;
import synthbackend;
sub vcl_recv {
if (req.method != "GET" && req.method != "PUT" && req.method != "DELETE") {
return (synth(405));
}
@jordansissel
jordansissel / 1-output.txt
Last active November 10, 2021 14:28
Convert curl|bash to an rpm with Docker and FPM
% docker build -t rust .
...
# Export the image to tarball, which itself contains tarballs and a manifest.json
% docker save -o rust.tar rust
# Extract the last layer
# tar's -O flag extracts a single entry from the tarball.
# The file we want is the last "Layer" in the manifest.json
% tar -xf rust.tar -O $(tar -xf rust.tar -O manifest.json | jq -r '.[].Layers[-1]') > curlbash.tar
@cowboy
cowboy / sudo-keepalive-example.sh
Created July 15, 2012 20:55
Bash: Sudo keep-alive (good for long-running scripts that need sudo internally but shouldn't be run with sudo)
#!/bin/bash
# Might as well ask for password up-front, right?
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Example: do stuff over the next 30+ mins that requires sudo here or there.
function wait() {