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 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
// "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
fileprivate let badChars = CharacterSet.alphanumerics.inverted | |
extension String { | |
var uppercasingFirst: String { | |
return prefix(1).uppercased() + dropFirst() | |
} | |
var lowercasingFirst: String { | |
return prefix(1).lowercased() + dropFirst() | |
} |
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
extension Data { | |
/** | |
Consumes the specified input stream, creating a new Data object | |
with its content. | |
- Parameter reading: The input stream to read data from. | |
- Note: Closes the specified stream. | |
*/ | |
init(reading input: InputStream) { | |
self.init() | |
input.open() |
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
pipeline { | |
agent any | |
environment { | |
UPSOURCE_URL = "http://your.upsource" | |
UPSOURCE_PROJECT = "your-project" | |
UPSOURCE_AUTH = credentials('upsource-auth') | |
// ^^ set this up as "secret text" credential in Jenkins; | |
// use the authentication token from Upsource project settings > integration | |
} |
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) |
NewerOlder