Skip to content

Instantly share code, notes, and snippets.

Avatar
🍵
Enjoying a nice cup of tea

Stephen Connolly stephenc

🍵
Enjoying a nice cup of tea
View GitHub Profile
@stephenc
stephenc / basic.r
Created Nov 15, 2020
A simple analysis of SARS-CoV-2 cases in Ireland with respect to Lockdown 2
View basic.r
library(ggplot2)
library(dplyr)
library(lubridate)
library(ggthemes)
owid <- dplyr::mutate(read.csv('owid-covid-data.csv'), Date=as.Date(date))
png("basic.png",width=1024,height=512)
ggplot(data=(owid %>% filter(iso_code=='IRL')),aes(x=Date,y=new_cases))+
geom_point()+
geom_smooth(data=(owid %>% filter(iso_code=='IRL') %>% filter(Date >= as.Date('2020-10-15'))),method=lm,color="red",fill="#69b3a2", se=TRUE)+
@stephenc
stephenc / analysis.r
Created Aug 15, 2020
Correllation vs Causation
View analysis.r
library(tidyverse)
library(grid)
library(zoo)
all = read.csv("owid-covid-data.csv", header = TRUE)
irl <- all %>%
filter(iso_code == "IRL") %>%
mutate(date=as.Date(date, format="%Y-%m-%d")) %>%
mutate(cma_cases = rollmean(new_cases, k=5, fill = NA)) %>%
mutate(cma_deaths = rollmean(new_deaths, k=5, fill = NA))
@stephenc
stephenc / covid-plot.r
Last active Aug 15, 2020
Plots new cases and new deaths on same graph
View covid-plot.r
library(tidyverse)
library(grid)
all = read.csv("owid-covid-data.csv", header = TRUE)
irl <- all %>%
filter(iso_code == "IRL") %>%
select(date,new_cases,new_deaths) %>%
mutate(date=as.Date(date, format="%Y-%m-%d"))
p1 <- ggplot(irl, aes(x=date,y=new_cases)) +
scale_x_date() +
@stephenc
stephenc / pom.xml
Created Aug 11, 2020
How to allow testing with a different version from the command line
View pom.xml
<project>
...
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>com.example.foo</groupId>
<artifactId>bar</artifactId>
<version>1.2.3</version>
</dependency>
@stephenc
stephenc / DatadogStatus.puml
Created Feb 28, 2020
A PlantUML sprite for a status badge
View DatadogStatus.puml
sprite $DatadogStatus [200x20/16] {
56666666666666666666666666666666666666666666666666666666666666666666666666666AAAAAAAAAAAAAAAAAAAAAAA9A00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
66666666666666666666666666666666666666666666666666666666666666666666666666666AAAAAAAAAAAAAAAAAAAAAAAAA00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
66666666666666666666666666666666666666666666666666666666666666666666666666666AAAAAAAAAAAAAAAAAAAAAAAAA00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
66666666666666666666666666666666666666666666666666666666666666666666666666666AAAAAAAAAAAAAAAAAAAAAAAAA00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
66666666631666666666666666666666666666666666666666666666666666666666666666666AAAAAAAAAAAAAAAAAAAAAAAAA000000000000000000000000000000000000000000000000000000000000000000000000
View StreamingJob.java
package myflink;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RuntimeContext;
View keybase.md

Keybase proof

I hereby claim:

  • I am stephenc on github.
  • I am stephenconnolly (https://keybase.io/stephenconnolly) on keybase.
  • I have a public key whose fingerprint is 6444 C030 9052 58CE 2E42 B511 DA9C 0CA7 B492 4CA3

To claim this, I am signing this object:

@stephenc
stephenc / bootstrap.min.css
Created Dec 13, 2018
centraal static content
View bootstrap.min.css
/*!
* Bootstrap v4.0.0 (https://getbootstrap.com)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:576px;--breakpoint-md:768px;--breakpoint-lg:992px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;
@stephenc
stephenc / Makefile
Created Oct 9, 2018
How to have a makefile only rebuild a docker image when needed
View Makefile
DOCKER_TAG = ...
.PHONY: build-image touch.build-image
build-image: touch.build-image .build-image
touch.build-image:
$(eval timestamp=$(shell docker inspect -f '{{ range $$i, $$e := split .Metadata.LastTagTime "T" }}{{if eq $$i 0}}{{range $$j, $$v := split $$e "-"}}{{$$v}}{{end}}{{else}}{{$$f := printf "%.8s" $$e}}{{range $$j, $$g := split $$f ":"}}{{if lt $$j 2}}{{$$g}}{{else}}.{{$$g}}{{end}}{{end}}{{end}}{{end}}' $(DOCKER_TAG) 2>/dev/null ))
@if [ "A$(timestamp)A" = "AA" ] ; then rm -f .build-image ; else touch -t $(timestamp) .build-image ; fi
.build-image: Dockerfile rootfs/*
@stephenc
stephenc / README.md
Last active May 4, 2018
Watch Me Code, Episode 5 pipeline shared libraries
View README.md

Watch Me Code - Episode 5

The build is defined in the vars/asfMavenTlpStdBuild.groovy file, that relies on the jenkinsEnv singelton.

Ideally you would put vars/jenkinsEnv.groovy in a separate repository (or at least a separate branch) and define two shared libraries:

  1. The shared library that defines jenkinsEnv
  2. The shared library that defines asfMavenTlpStdBuild

This way, to migrate to a different Jenkins master, we just need a different jenkinsEnv singleton that respects the same API contract.

You can’t perform that action at this time.