Skip to content

Instantly share code, notes, and snippets.

Christian Höltje docwhat

Block or report user

Report or block docwhat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@docwhat
docwhat / build.bash
Created Aug 16, 2019
Build a docker image with bash
View build.bash
#!/bin/bash
set -eu
cmd=
cname=bob
colour() {
tput bold
tput smso
@docwhat
docwhat / DockerPipelineWithCleanup.java
Last active Jul 22, 2019 — forked from abayer/DockerPipelineWithCleanup.java
Declarative Pipeline Docker-with-cleanup agent type
View DockerPipelineWithCleanup.java
// This would be in src/main/java/whatever/DockerPipelineWithCleanup.java
package whatever;
import hudson.Extension;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.AbstractDockerAgent;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgent;
import org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor;
import org.kohsuke.stapler.DataBoundConstructor;
@docwhat
docwhat / duquesnelight-outages.rb
Created Jul 11, 2019
Check for power outages from Duquesne Light in Pittsburgh.
View duquesnelight-outages.rb
#!/usr/bin/env ruby -w
# frozen_string_literal: true
require 'json'
require 'open-uri'
require 'date'
class Outage
attr_reader :name, :zip, :lat, :long, :number_affected, :last_updated
@docwhat
docwhat / docker-bridge-example.bash
Created Apr 6, 2019
Example of using docker bridge networking
View docker-bridge-example.bash
#!/bin/bash
PS4='+\[\033[01;34m\](${BASH_SOURCE[0]}:${LINENO})\[\033[00m\]: ${FUNCNAME[0]:+\[\033[01;33m\]${FUNCNAME[ 0]}()\[\033[00m\]: }'
set -eu
# Tear Down previous run
{
docker container rm -f db client || true
docker network rm majidi || true
@docwhat
docwhat / Jenkinsfile
Last active Apr 29, 2019
Example pipeline usage of the Jenkins Mask Passwords plugin
View Jenkinsfile
// Requires https://plugins.jenkins.io/mask-passwords to run
/**
* Runs code with secret environment variables and hides the values.
*
* @param varAndPasswordList - A list of Maps with a 'var' and 'password' key. Example: `[[var: 'TOKEN', password: 'sekret']]`
* @param Closure - The code to run in
* @return {void}
*/
def withSecretEnv(List<Map> varAndPasswordList, Closure closure) {
@docwhat
docwhat / example.md
Last active Aug 14, 2018
docker-envfile-example
View example.md

The format of the env-file is explain at https://docs.docker.com/compose/env-file/.

# I'm using bash, but it applies with sh and zsh as well.
$ echo $BASH_VERSION
4.4.23(1)-release
# Create a simple env-file for testing.  We're using = and ! to
# push at some corner cases.
$ echo 'THISISAVARIABLE=This is the value that even has an = sign!' > /tmp/concoction.env
$ cat /tmp/concoction.env
@docwhat
docwhat / Dockerfile
Created May 18, 2018
Multi-stage maven dockerfile with caching
View Dockerfile
# Requires docker 17.06 to build
# ----
# Install Maven
FROM openjdk:8-jdk-alpine AS maven
RUN apk add --no-cache curl tar bash
ARG MAVEN_VERSION=3.3.9
ARG USER_HOME_DIR="/root"
RUN mkdir -p /usr/share/maven && \
curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && \
@docwhat
docwhat / async-requires1.js
Created Mar 23, 2018
Debugging Gist slowness
View async-requires1.js
This file has been truncated, but you can view the full file.
// prefer default export if available
const preferDefault = m => m && m.default || m
exports.components = {
"component---src-templates-post-js": require("gatsby-module-loader?name=component---src-templates-post-js!/Users/docwhat/Play/WebSites/docwhat/src/templates/post.js"),
"component---src-templates-page-js": require("gatsby-module-loader?name=component---src-templates-page-js!/Users/docwhat/Play/WebSites/docwhat/src/templates/page.js"),
"component---cache-dev-404-page-js": require("gatsby-module-loader?name=component---cache-dev-404-page-js!/Users/docwhat/Play/WebSites/docwhat/.cache/dev-404-page.js"),
"component---src-pages-all-js": require("gatsby-module-loader?name=component---src-pages-all-js!/Users/docwhat/Play/WebSites/docwhat/src/pages/all.js"),
"component---src-pages-index-js": require("gatsby-module-loader?name=component---src-pages-index-js!/Users/docwhat/Play/WebSites/docwhat/src/pages/index.js"),
@docwhat
docwhat / nerd-firacode-font.css
Last active Oct 13, 2018 — forked from danielfullmer/nerd-font.css
blinksh font configuration file
View nerd-firacode-font.css
@font-face {
font-family: 'Nerd FiraCode Retina';
src: local('Nerd FireCode Retina'), url('https://raw.githubusercontent.com/ryanoasis/nerd-fonts/2.0.0/patched-fonts/FiraCode/Retina/complete/Fura%20Code%20Retina%20Nerd%20Font%20Complete.otf') format('opentype');
}
* {
text-rendering: optimizeLegibility;
}
@docwhat
docwhat / Jenkinsfile
Created Feb 10, 2017
Jenkinsfile: check scm woes with the GitHub Org Folders
View Jenkinsfile
#!groovy
node {
stage('desired') {
// This is what I'd like to be able to do... Though there are lots of other extenions that are useful, like
// CleanBeforeCheckout and PruneStaleBranch
// Don't forget submodule configuration!
scm.extenions = scm.extensions + [[$class: 'CloneOption', noTags: true, reference: '', shallow: true]]
checkout scm
}
You can’t perform that action at this time.