Skip to content

Instantly share code, notes, and snippets.

@graymic
graymic / LambdaEfsBackup.py
Created October 1, 2018 13:38 — forked from eduardcloud/LambdaEfsBackup.py
Backup EFS file-system to S3 with lambda function
import boto3
import time
region = 'eu-west-1'
user_data_script = """#!/bin/bash
instanceid=$(curl http://169.254.169.254/latest/meta-data/instance-id)
cd /
mkdir moodledata
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-xxxxxxxxxxc.efs.eu-west-1.amazonaws.com:/ moodledata
tar czf mooodledata-backup-$(date +%d-%m-%Y_%H-%M).tar.gz /moodledata
aws s3 mv mooodledata-backup-*.tar.gz s3://xxxxxxxxx/
### Keybase proof
I hereby claim:
* I am graymic on github.
* I am graymic (https://keybase.io/graymic) on keybase.
* I have a public key ASCF7mw8OWmMo__BRur4fsg7IX8EnnjRMd7IbR496RnQ5Ao
To claim this, I am signing this object:
@graymic
graymic / docker-compose.yml
Created March 19, 2017 22:09
Python & Kafka through Docker
version: '2'
services:
## Apache zookeeper
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
@graymic
graymic / _README.md
Created August 1, 2016 08:12 — forked from schickling/_README.md
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@graymic
graymic / NginxImageResizer.conf
Last active August 29, 2015 14:21
Nginx Image Resizer - GD
server {
server_tokens off;
listen 8880 default_server;
listen [::]:8880 default_server ipv6only=on;
root /data/sites/my-site/;
index index.html index.htm;
server_name my-site.com;
@graymic
graymic / DraftTrait.php
Created November 25, 2014 21:29
Draft system for Eloquent Models
<?php namespace path\to\your\traits\directory;
/**
* Class DraftTrait
*
* @package app\acme\Services\Traits
*/
trait DraftTrait {
/**
@graymic
graymic / PolymorphicModelNamespaces.php
Last active August 29, 2015 14:09
Polymorphic Model Namespaces
<?php Some\Extended\Models\Namespace;
class MyBespokeModel extends Some\Other\Parent\Namespace\Model {
/**
* As this class is \App\Api\Models - Map the polymorphic relationship to this model
* so that it can be accessed either by Common\Models or Api\Models.
*
* @var string
*/
@graymic
graymic / EloquentRepository.php
Created October 23, 2014 15:30
Laravel 4 Eloquent Repository Abstract
<?php namespace app\Acme\Repositories;
/**
* Class EloquentRepository
* @package app\Acme\Repositories
*/
abstract class EloquentRepository {
/**
* @var $model \Eloquent;
@graymic
graymic / environment.php
Last active September 25, 2015 09:48
environments - dotenv Laravel5
<?php
// You can ofc ignore this and load it in from the default .env file, however I prefer this method for load dot files.
// Dotenv::load(__DIR__.'/../');
// Dotenv::require('APP_ENV');
$dotenv = function () {
$env = getenv('APP_ENV') ?: 'local';
if (file_exists(__DIR__.'/../')) {
Dotenv::load(__DIR__.'/../', '.env.' . $env);
}
@graymic
graymic / Gulpfile.js
Last active August 29, 2015 14:07
Example Gulpfile - Foundation5, SASS, Laravel5
var gulp = require('gulp'),
sass = require('gulp-sass'),
minify = require('gulp-minify-css'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
growl = require('gulp-notify-growl'),
phpunit = require('gulp-phpunit'),
prefix = require('gulp-autoprefixer'),