This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Depends on https://github.com/mikefarah/yq | |
set -euo pipefail | |
# # INPUT | |
# The playbook (YAML file) you want to patch" | |
playbook="${1}" | |
# URL of the Git repository that contains the content source under test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "Stash" in one stage ... | |
script { | |
stashAsArtifact(this, 'node-dependencies', '**/node_modules/') | |
} | |
// ... and "unstash" in another | |
script { | |
unstashFromArtifact(this, 'node-dependencies') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:11 AS build | |
RUN apt-get update \ | |
&& apt-get install -y libsdl2-dev alsa-utils g++ make wget | |
RUN mkdir /whisper && \ | |
wget -q https://github.com/ggerganov/whisper.cpp/tarball/master -O - | \ | |
tar -xz -C /whisper --strip-components 1 | |
WORKDIR /whisper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginxinc/nginx-unprivileged:alpine | |
COPY build/site /usr/share/nginx/html/ | |
# Inject the rewrite rules antora generates into the nginx config: | |
# 1. Add \ to the end of every line (to make the multi-line sed command in 3. work), and | |
# indent all lines (cosmetics). | |
# 2. Append another ("escaped") empty line (cosmetics). | |
# 3. Insert what we got before the final closing brace in the default config file. | |
# NB: Using % as separator for the replace command because rewrite.conf contains many / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
ARG foo="setme" | |
# Available at build time: | |
RUN echo foo=${foo} > foo | |
# Need to "convert" into environment variable so it's available at runtime: | |
ENV FOO ${foo} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"type": "object", | |
"definitions": { | |
"shared-def": { | |
"type": "string", | |
"pattern": "^shared-" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LazyJdbcConnection extends JdbcConnection { | |
public LazyJdbcConnection(JdbcTemplate jdbcTemplate) { | |
super(jdbcTemplate); | |
} | |
public <T> T executeQueryLazily(final String sqlQuery, final LazyResultSetExtractor<T> resultSetExtractor) throws SQLException { | |
log.debug("Executing query: {}", sqlQuery); | |
if (jdbcTemplate.getDataSource() == null) { | |
throw new SQLException("Data source not available via JdbcTemplate"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun maximalSplits(pieces: List<Int>, width: Int): List<Pair<Map<Int, Int>, Int>> { | |
fun maximalSplits(partial: List<Int>): List<List<Int>> { | |
val longerSplits = pieces | |
.filter { partial.sum() + it < width } | |
.map { (partial + it).sorted() } | |
.flatMap { maximalSplits(it) } | |
.distinct() | |
if (longerSplits.isEmpty()) { | |
return listOf(partial) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build test | |
package main | |
import "go.uber.org/zap" | |
func makeLogger() (*zap.Logger, error) { | |
return zap.NewDevelopment() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: | |
# | |
# - Run something: ./$ npm --version | |
# - Setup something: Add a suitable `prepare` script to your `package.json`, e.g. | |
# | |
# "scripts": { | |
# "prepare": "npm i -g @zeit/ncc" | |
# } |
NewerOlder