Skip to content

Instantly share code, notes, and snippets.

24HOURSMEDIA / docker-compose.yml
Last active January 19, 2024 17:20
Caching proxy for S3 with SSL terminator
View docker-compose.yml
# ssl terminator docs:
image: 24hoursmedia/nginx-ssl-terminator:1.2.0-nginx1.25-alpine3.18-slim
restart: always
- caching_proxy
- "${PUBLIC_HTTPS_PORT:-443}:12443"
Last active November 7, 2023 15:01
AWS AMI 2023 Add docker and docker compose plugin
set -e
set -o pipefail
# Install docker and docker compose plugin on AWS Linux AMI 2023
# Defaults to compose plugin for intel machines
# Run this with:
# bash <(curl -sL$(date +%s))
Last active July 29, 2023 12:07
test disk speed with had-arm
sudo apt-get install hdparm
# get disk names with
sudo lsblk -l
# test speed without cache
sudo hdparm -Tt --direct /dev/sda1
# with cache
24HOURSMEDIA / __info.txt
Last active July 29, 2023 11:45
public key authentication only
View __info.txt
# Add your ssh keys first to .ssh/authorized keys
# Be sure to have the proper permissions:
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
Last active July 29, 2023 12:15
Install docker on raspberry pi
sudo curl -sSL | sh
sudo usermod -aG docker $USER
24HOURSMEDIA / Jenkinsfile
Last active July 26, 2023 18:53
Jenkinsfile that shows how variables are handled in a regular agent and an agent running docker
View Jenkinsfile
* A declarative Jenkins pipeline tjat demonstrates how variables are handled in Jenkins pipelines
* and more specifically how they are handled in stages where the agent running the stage is a docker containers.
* EAP Bachman / 24hoursmedia
24HOURSMEDIA / output.txt
Created October 8, 2021 07:40
test php deferred destruction when callbacks are injected
View output.txt
no callback: testing...destruct...
with callback: testing...callback...destruct...
with callback 2: testing...callback...destruct...was unset...
(destruct was always called so that's ok)
24HOURSMEDIA / auto_decompress_kernel
Last active May 14, 2021 07:45
auto_decompress_kernel for ubuntu20.04 server / rpi usb boot (improved)
View auto_decompress_kernel
#!/bin/bash -e
# Put this script in the root of the boot partition (i.e. system-boot) and chmod it with +x
# Set Variables
#Check if compression needs to be done.
if [ -e $BTPATH/check.md5 ]; then
24HOURSMEDIA / country_currency_map.php
Created February 6, 2021 10:18
Array of country codes to ISO-4217 currency codes as php array
View country_currency_map.php
return [
'AD' => 'EUR',
'AE' => 'AED',
'AF' => 'AFN',
'AG' => 'XCD',
'AI' => 'XCD',
'AL' => 'ALL',
'AM' => 'AMD',
24HOURSMEDIA / aws-s3-examples.php
Created January 28, 2019 15:50
Some quick examples in php to read and store data and files on AWS S3
View aws-s3-examples.php
// assume aws sdk is in composer: "aws/aws-sdk-php": "^3.0",
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../local/credentials.php';
$bucket = 'BUCKETNAME'
$awsCredentials = new \Aws\Credentials\Credentials($AWS_KEY, $AWS_SECRET);