Arduino Student Kit February-April 2022 lead by Matt Johnson
Arduino Student Kit
<?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 |
# 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') |
-- Please set your vpn connection name and password here | |
set VPNName to "VPN name" | |
set VPNpassword to "VPN password" | |
tell application "System Events" | |
tell current location of network preferences | |
set VPNService to service VPNName | |
end tell | |
set isConnected to connected of current configuration of VPNService |
tell application "System Events" | |
-- get current clipboard contents as a string | |
set CurrentClipboard to the clipboard as string | |
-- set the clipboad to your password | |
set the clipboard to "Y0urVPNPa$$w0rd" | |
-- start playing with the VPN | |
tell current location of network preferences | |
/* Grab the values and make them globally available. */ | |
var hoursPerDay = 8; | |
var hoursPerWeek = hoursPerDay * 5; | |
/** | |
* We calculate the number of hours in a given range. | |
*/ | |
function SUMTIME(allData) { | |
var numHours = 0; | |
var numCells = allData.length; |
#!/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}') |
/* | |
# Get size of a specific database into a bash variable for use in estimating mysqldump size for pv status bar | |
DATABASE_NAME="example_db_name" | |
DATABASE_SIZE=$(mysql --batch -sN -e "SELECT CONCAT(ROUND(sum( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 0), 'g') as size FROM information_schema.TABLES WHERE table_schema = '${DATABASE_NAME}' GROUP BY table_schema;") | |
echo "${DATABASE_SIZE}" | |
*/ | |
/* find the largest tables on the server */ | |
SELECT CONCAT(table_schema, '.', table_name) 'db.table', | |
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, |
# clear the entire cache | |
varnishadm "ban req.url ~ /" | |
# monitor varnish stats | |
varnishstat -n prod | |
# monitor varnish log with multiple patterns | |
varnishlog | grep 'eqURL\|Age:\|VCL_call\|TTL\|Expires:\|Cache-Control:' | |
# Use a query with varnishlog to watch requests from a specific IP |
#!/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 |