Skip to content

Instantly share code, notes, and snippets.

View toolmantim's full-sized avatar
:shipit:
🎉

Tim Lucas toolmantim

:shipit:
🎉
View GitHub Profile
@toolmantim
toolmantim / README.md
Created October 27, 2023 00:41
An example custom Cody explain command that targets more experienced developers and highlights any security concerns

Custom Cody Command: /explain-with-security

A custom Cody command that is more suited to experienced developers, and highlights any security concerns.

{
  "commands": {
    "explain-with-security": {
      "description": "Explain code w/ security analysis",
      "prompt": "Explain and document the shared code in literate markdown form, including code blocks containing the original code. Start with a summary of the overall code. Assume the audience is an experienced programmer who understands the language features and syntax. Explain how each section achieves its purpose through the logic and algorithm. Include a section explaining any security concerns found. Write the explanation assuming no prior context about the code is known. Do not make assumptions about variables or functions not shown in the shared code. Output only the explanation without any 'Here is' style preface or final remarks.",
# A minimal Docker image with Node and Puppeteer
#
# Initially based upon:
# https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
FROM node:16.15.1-buster-slim@sha256:3c8acd4934617f60dad7e4cc941faa064aa5a14da437dc156bdcad9d4a67bc4e as puppeteer
RUN apt-get update \
&& apt-get install -y wget gnupg ca-certificates procps libxss1 git \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
steps:
- command: "echo ${BUILDKITE_PULL_REQUEST_REPO:-$BUILDKITE_REPO}"
fetch('https://api.github.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.GITHUB_API_TOKEN}`
},
body: JSON.stringify({ query: query() })
})
.then((res) => res.json())
.then((data) => {
steps:
- command: ls

Firstly, build the Docker image:

curl https://gist.githubusercontent.com/toolmantim/c731730b4b4b7989f8f045956346bcfe/raw/Dockerfile | docker build -t bk -

Then try to use it in a project that has a buildkite pipeline.yml file:

docker run -it --rm -v "$(PWD):/app" bk run local
@toolmantim
toolmantim / step.sh
Created November 5, 2018 05:04
An example of dynamically adding a trigger step during a running Buildkite build
#!/bin/bash
set -euo pipefail
cat << YML | buildkite-agent pipeline upload
steps:
- trigger: "other-pipeline"
async: true
build:
message: "${BUILDKITE_MESSAGE}"
@toolmantim
toolmantim / buildkite.yml.schema.json
Last active October 21, 2018 23:59
JSON Schema for Buildkite Pipeline files
{
"title": "JSON schema for Buildkite pipeline configuration files",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"label": {
"type": "string",
"description": "The label that will be displayed in the pipeline visualisation in Buildkite. Supports emoji.",
"examples": [ ":docker: Build" ]
},
"branches": {
@toolmantim
toolmantim / pipeline-2.yml
Last active June 17, 2018 11:54
Checking a prometheus
steps:
- label: "🔍"
command: 'docker run --rm --entrypoint sh -v "$PWD/prometheus.yml:/src/prometheus.yml" prom/prometheus promtool check config /src/prometheus.yml'
@toolmantim
toolmantim / buildkite-bootstrap-wrapper-build-log-output
Last active June 11, 2018 02:36
An example custom Buildkite Agent bootstrap wrapper that logs the output of all build jobs.
#!/bin/bash
set -euo pipefail
# A custom bootstrap wrapper that logs the output of all build jobs.
#
# To use this file, either set the env variable before starting the agent:
# BUILDKITE_BOOTSTRAP_SCRIPT_PATH=/path-to-this-file
#
# or the agent configuration key: