Arduino Student Kit February-April 2022 lead by Matt Johnson
Arduino Student Kit
#!/bin/bash | |
set -euo pipefail | |
FRONT_URL="${FRONT_URL:-https://app.exampleproject.test/}" | |
echo "==> [$(date +%H:%M:%S)] waiting on readiness" | |
ELAPSED_SECONDS=0 | |
while : ; do | |
ELAPSED_SECONDS=$(echo ${ELAPSED_SECONDS}+2 | bc) | |
RESPONSE_CODE=$(curl -sI "${FRONT_URL}" 2>/dev/null | head -n1 | awk '{print $2}') |
I recently had the following problem:
We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like
ssh -L 3306:localhost:3306 remotehost
# You can find the current list of casks on github, and the one for vagrant here: | |
# https://github.com/Homebrew/homebrew-cask/blob/master/Casks/vagrant.rb | |
# From there you may be able to load the history of that file and lookup previous versions of | |
# the cask which would be related to previous versions of vagrant as indicated in the cask definition file. | |
# If the github history of the file fails you can search through recent commit history and find a commit prior | |
# to the version change you are trying to avoid and get the commit hash before the change and use it to locate | |
# a previous version of the cask file. | |
# current (master branch) casks: |
#!/bin/bash | |
# This quick and dirty script installs the Source Guardian loader on the web70 VM. | |
# Similar commands should work on other version of PHP -- simply replace the .lin file copied and the .ini file with the correct version. | |
cd /tmp | |
wget https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz -O ./source-guardian.tgz | |
mkdir source-guardian |
# The check_url recursive function | |
check_url() { | |
THIS_URL="${1}" | |
HTTP_RESP_CODE=$(curl -ksI "${THIS_URL}" | grep -i 'HTTP/' | cut -d' ' -f 2) | |
echo "${THIS_URL} -> ${HTTP_RESP_CODE}" | |
if [ "${HTTP_RESP_CODE}" == "301" ] || [ "${HTTP_RESP_CODE}" == "302" ] | |
then | |
HTTP_LOC=$(curl -ksI ${1} | grep -i 'Location: ' | cut -d'_' -f 2) | |
HTTP_REDIRECT=$(echo "${HTTP_LOC}" | tail -c +11 | tr -d '\r' | tr -d '\n') |
# Consider filtering the varnishlog output | |
# https://feryn.eu/blog/varnishlog-measure-varnish-cache-performance/ | |
varnishlog -i "RespHeader,Req*" -X "RespHeader:(x|X)-" -I "timestamp:Resp" -x reqprotocol,reqacct -g request | |
# Capture the log output from varnishlog and look for BereqHeader | |
# -n name is how you can specify a specific named instance of varnish | |
# remove -n if you just want to access the default instance | |
varnishlog -n stage |
<?php | |
function require_auth() { | |
$AUTH_USER = 'admin'; | |
$AUTH_PASS = 'admin'; | |
header('Cache-Control: no-cache, must-revalidate, max-age=0'); | |
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])); | |
$is_not_authenticated = ( | |
!$has_supplied_credentials || | |
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER || | |
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS |
# Setup local directory with braintree example and libraries | |
git clone [email protected]:braintree/braintree_php_example.git | |
cd braintree_php_example | |
composer install | |
# Create and define configuration options | |
echo ' | |
BT_ENVIRONMENT=sandbox | |
BT_MERCHANT_ID=xxxxxxxxxxxx | |
BT_PUBLIC_KEY=xxxxxxxxxxxx |