Skip to content

Instantly share code, notes, and snippets.

@mezzomondo
mezzomondo / aurora_vertical_scaling.md
Last active October 10, 2023 12:32
Automatic vertical scaling of an Aurora cluster

The problem (AKA don't waste money)

One of my clients is a big company that has a very variable but predictable database usage pattern. In the weekdays morning they come up with a huge amount of INSERTs and UPDATEs while for the rest of the day, form noon on, the usage is fairly limited to a decent amount of SELECTs with very low writing activity. The smallest class type that can handle the morning's volume is db.r3.large but having such an instance running all day long and in the weekends is just a big waste of resources money (or a big favour we do to Amazon, from their point of view).

The solution

So I was wondering if there's some autoscaling mechanism for Aurora writers (there is, but only for replicas),

@lattner
lattner / TaskConcurrencyManifesto.md
Last active April 18, 2024 09:44
Swift Concurrency Manifesto
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@ishults
ishults / gitTestModified.sh
Last active February 14, 2017 18:36
Main script
#!/bin/sh
usage(){
echo "Usage: `basename $0` [-h] [-r] [-t testOptions] [<directory>...]\n"
echo ' -h Show this help message.'
echo ' -r Remove the default directories, and only use the ones provided. Without the flag, the provided directories will be appended to the default list.'
echo ' -t Options to pass to "grails test-app". Default: none.'
echo ' See: http://grails.org/doc/latest/ref/Command%20Line/test-app.html'
}
# Parse the arguments
@bjfish
bjfish / example_grails_travis_build_matrix.yml
Created October 8, 2013 21:29
Example Grails Travis build matrix
language: groovy
jdk:
- oraclejdk6
env:
- GRAILS_VERSION=2.2.4
- GRAILS_VERSION=2.2.3
- GRAILS_VERSION=2.2.2
- GRAILS_VERSION=2.2.1
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@n1k0
n1k0 / Howto.md
Created October 1, 2012 17:59
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
@jonraasch
jonraasch / jQuery.support-transition.js
Created April 21, 2010 14:32
Extends the jQuery.support object to CSS3 transition
// jQuery.support.transition
// to verify that CSS3 transition is supported (or any of its browser-specific implementations)
$.support.transition = (function(){
var thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined;
return support;
})();
@tjlytle
tjlytle / imageColor.php
Created November 17, 2009 19:19
Class to find 'average' image color.
<?php
/**
* imageColor
*
* Shows three methods to find the 'average' image color.
*
* Each function expects a gd image object.
*
* imageColor::averageResize($image) resizing to 1px, and checking the color.
* imageColor::averageBorder($image) find the average color of all border pixels.