- Hire only coders.
- Have an SLA for your service.
- Measure and report performance against the SLA.
- Use Error Budgets and gate lanches on them.
- Have a common staffing pool for SRE and Developers.
- Have excess Ops work overflow to the Dev team.
- Cap SRE operational load at 50 percent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias docker_remove_all_containers='docker rm ($docker ps -aq)' | |
| alias force_docker_remove_all_containers='docker rm -f ($docker ps -aq) | |
| alias docker_remove_all_unused_volumes='docker volume prune' | |
| alias docker_remove_all_images='docker rmi $(docker images -q)' | |
| alias force_docker_remove_all_images='docker rmi -f $(docker images -q)' |
- IIFE -- immediately invoked function expression
- closure -- technique for implementing lexically scoped name binding in a language with first-class functions
- transpiler, transcompiler, source-to-source compiler -- is a type of compiler that takes the source code of a program written in one programming language as its input and produces the equivalent source code in another programming language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if [ $# -eq 0 ] | |
| then | |
| echo "No arguments supplied" | |
| else | |
| mysql -uroot --execute="CREATE DATABASE $1 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # backup files from a docker volume into /tmp/backup.tar.gz | |
| # from http://stackoverflow.com/questions/21597463/how-to-port-data-only-volumes-from-one-host-to-another | |
| function docker-volume-backup-compressed() { | |
| docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}" | |
| } | |
| # restore files from /tmp/backup.tar.gz into a docker volume | |
| function docker-volume-restore-compressed() { | |
| docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}" | |
| echo "Double checking files..." | |
| docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <string.h> | |
| #include <math.h> | |
| #include <stdlib.h> | |
| int solveMeFirst(int a, int b) { | |
| return a+b; | |
| } | |
| int main() { | |
| int num1,num2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT SUM(TABLE_ROWS) FROM `information_schema`.`tables` WHERE `table_schema` = 'your_database_name'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // ... | |
| # using a Heroku Postgresql DB | |
| $heroku_db_url = parse_url($_ENV['DATABASE_URL']); | |
| $databases['default']['default'] = array( | |
| 'driver' => 'pgsql', | |
| 'database' => substr($heroku_db_url['path'], 1), | |
| 'username' => $heroku_db_url['user'], | |
| 'password' => $heroku_db_url['pass'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <IfModule mod_expires.c> | |
| ExpiresActive On | |
| ExpiresDefault "access plus 1 year" | |
| ExpiresByType text/html "access plus 300 seconds" | |
| ExpiresByType text/css "access plus 1 year" | |
| ExpiresByType application/javascript "access plus 1 year" | |
| ExpiresByType audio/ogg "access plus 1 year" | |
| ExpiresByType image/gif "access plus 1 year" | |
| ExpiresByType image/jpeg "access plus 1 year" | |
| ExpiresByType image/png "access plus 1 year" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Implements hook_views_query_alter() | |
| */ | |
| function views_pager_mod_views_pre_execute(&$view) { | |
| // some data to be used | |
| $query_params = drupal_get_query_parameters(); |