Skip to content

Instantly share code, notes, and snippets.

@breenie
breenie / user-data.yml
Last active July 19, 2019 10:05
yum-cron security only cloud-config example
#cloud-config
packages:
- yum-cron
runcmd:
- yum clean all
- sed -ie 's/update_cmd = default/update_cmd = security/' /etc/yum/yum-cron.conf
- sed -ie 's/update_cmd = default/update_cmd = security/' /etc/yum/yum-cron-hourly.conf
@breenie
breenie / PHP-remote-debug.md
Last active July 1, 2019 12:37
PHP remote debugging checklist for dummies...

PHP Remote debugging

Ensure xdebug is installed on remote and local 🤪.

Remote xdebug.ini

xdebug.remote_enable=1
#xdebug.remote_autostart=0
#xdebug.remote_connect_back=0
@breenie
breenie / gist:f8a107d8c38e13e4b681c7ac94a8c693
Created May 22, 2019 19:23
Generate ssh fingerprint for AWS
openssl pkey -in ~/.ssh/id_rsa -pubout -outform DER | openssl md5 -c
@breenie
breenie / bitbucket.sh
Last active February 27, 2019 15:28
Bitbucket Server init script for RHEL/CentOS. Cobbled together from the official scripts and other littered about GitHub
#! /bin/sh
### BEGIN INIT INFO
# Provides: bitbucket
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Initscript for Atlassian Bitbucket Server
# Description: Automatically start Atlassian Bitbucket Server when the system starts up.
@breenie
breenie / offer.js
Created February 15, 2019 12:59
Buy x for y offer (2 for 3 for example)
const assert = require('assert');
function offer(x, y, itemsInBasket) {
return Math.ceil((itemsInBasket / x) * y);
}
assert.equal(offer(2, 1, 1), 1);
assert.equal(offer(2, 1, 3), 2);
assert.equal(offer(2, 1, 4), 2);
assert.equal(offer(2, 1, 5), 3);
@breenie
breenie / deeplens.md
Last active January 16, 2019 11:41
DeepLens notes on MacOS

DeepLens on MacOS

Useful/condescending items

Add your ssh identity to the device:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub aws_cam@${DEVICE_IP}
@breenie
breenie / php.ini
Created May 31, 2018 16:08
PHP.ini customisations
allow_url_fopen="On"
date.timezone="Europe/London"
detect_unicode="Off"
display_errors="On"
display_startup_errors="On"
error_reporting="32767"
html_errors="On"
ignore_repeated_errors="On"
max_execution_time="300"
memory_limit="2G"
@breenie
breenie / get-out-of-jail.sh
Last active February 23, 2018 13:45
RDS get out of jail free space card
#!/bin/sh
# https://aws.amazon.com/premiumsupport/knowledge-center/rds-out-of-storage/
aws rds modify-db-instance --db-instance-identifier meatballs-mysql-rds-prod --allocated-storage 120 --apply-immediately
@breenie
breenie / lambda.js
Created November 24, 2017 12:35
SES push attachments to S3
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const mailParser = require('mailparser').simpleParser;
const dateFormat = require('dateformat');
const path = require('path');
const config = {
incomingBucket: process.env.INCOMING_BUCKET || 'ldsc-webcam',
incomingPrefix: process.env.INCOMING_PREFIX || 'incoming/',
outgoingBucket: process.env.OUTGOING_BUCKET || 'ldsc-webcam',
@breenie
breenie / iOS-Dropbox-naming.sh
Created October 16, 2017 11:07
Make iOS movie file names like Dropbox file names
#!/usr/bin/env bash
for file in *.MOV
do
date=$(date -r $file '+%Y-%m-%d %H.%M.%S')
mv "$file" "${date}.mov"
done