Skip to content

Instantly share code, notes, and snippets.

View akbertram's full-sized avatar

Alex Bertram akbertram

View GitHub Profile
library(activityinfo)
## Change configuration here
databaseId <- "cjw8lkpkfqhhcl92"
fromRoleLabel <- "Reporting partner"
toRoleLabel <- "Reporting partner (2)"
## End configuration

Jenkins Build Agent scripts

These scripts, using Hashicorp Packer, prepare a Google Cloud Image that can be used for a Jenkins Agent to build a Java project (which in this case also requires Node, Docker, and Google Chrome for running WebDriver tests).

I find that using Packer to create the image has several advantages over using Docker images for build steps, namely:

  1. Faster start up, and can be used together with stateful build agents.
  2. Build logic can fully live in our Gradle scripts rather .yaml build steps each with a different Docker container
@akbertram
akbertram / README.md
Last active January 6, 2024 11:19
Pair of scripts to start and stop GCE VMs when needed using the Command Launcher Plugin

Intro

These scripts are somewhat complicated way of using a stateful GCE VM as a Jenkins agent.

Rather than creating fresh new instances every time an agent is need, as the GCE Plugin currently does, an existing VM is simply started and stopped as needed.

This can yield significant speed ups in build time, as the VM's persistent disk retains Gradle's dependency caches, previously downloaded Docker images, etc.

@akbertram
akbertram / 01-setup.R
Last active July 12, 2023 02:34
Examples scripts from the 2022-09-22 webinar
install.packages("remotes")
remotes::install_github("bedatadriven/activityinfo-R")
install.packages("tidyverse")
# Go make some coffee :-)
# Add a Personal API Token first and copy that into the password
library(activityinfo)
activityInfoLogin()
library(activityinfo)
survey <- queryTable(form = "cftn7a7l30lb9ox2")
training <- subset(survey, group == "Training")
control <- subset(survey, group == "Control")
t.test(training$income, control$income,
alternative = "two.sided",
var.equal = FALSE)
# This only needs to be run once, if you don't have these packages installed.
install.packages("ltm", "devtools")
devtools::install_github("bedatadriven/activityinfo-R")
# Load the activityinfo package, as well as the ltm package which
# provides the cronbach alpha's implementation
library(activityinfo)
library(ltm)
@akbertram
akbertram / README.md
Last active February 22, 2024 10:39
Fingerprint Scanning with WebUSB

These are notes regarding an experimental attempt to operate a SecuGen HU20 fingerprint scanner with WebUSB. I wanted to learn a bit about the WebUSB protocol and to assess how feasible such a project would be.

The ideal is that our web application would be able to interact directly with the Fingerprint Scanner on a Windows, Mac or Android Tablet or phone without having to muck around with drivers or other installed software.

Problems

There are unfortunately two principle problems that undermine this ideal.

The first and most significant from my point of view is that interacting with the Fingerprint Scanner requires significant mucking about on Windows

library(httr)
offset <- 0
classifications <- list()
while(TRUE) {
res <- content(GET(sprintf("https://eventresults-api.sporthive.com/api/events/6607610161960078848/races/470648/classifications/search?count=50&offset=%d", offset)))
if(length(res$fullClassifications) == 0) {
break;
}
@akbertram
akbertram / Dockerfile
Last active December 5, 2019 13:38
Malware scanner
FROM gcr.io/google-appengine/jetty
ADD scanner.war $APP_DESTINATION
# generate quickstart-web.xml to speed up startup time
RUN /scripts/jetty/quickstart.sh
RUN apt-get update && \
apt-get install clamav-daemon -y && \
@akbertram
akbertram / ColumnMenu.scss
Last active October 17, 2019 13:59
ColumnMenu Styles
/*
Column Dropdown Menu
Column menus have slightly different requirements from other drop down menus.
Here are a few requirements:
1. Anchor vertically to the top of the datatable body
2. Center horizontally to the center of the column filter button, but constrained to the
left and right edges of the data table body.