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
| # This specifies the deployment process on AWS ElasticBeanstalk for a Django app using npm and Postgres. | |
| # | |
| # The target environment should have access to a Postgres Database through environment variables. | |
| # The environment can be setup using `eb create --database.engine=postgres` | |
| # The necessary environment variables to access the database will be automatically defined on the | |
| # instances of that environment. | |
| # | |
| # In addition, the target environment should define environment variables (django secret key ...). | |
| # They can be manually defined using the AWS ElasticBeanstalk interface on the web. | |
| # They can also be specified when creating the environment from command line, for example: |
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
| """ | |
| Two things are wrong with Django's default `SECRET_KEY` system: | |
| 1. It is not random but pseudo-random | |
| 2. It saves and displays the SECRET_KEY in `settings.py` | |
| This snippet | |
| 1. uses `SystemRandom()` instead to generate a random key | |
| 2. saves a local `secret.txt` |
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
| #!/bin/bash | |
| # A port of ZFS stats for FreeBSD plugin to Linux, adapted to send metrics to statsd. | |
| # | |
| # Author: Daniele Valeriani <daniele@valeriani.co.uk> | |
| # Author of the original munin plugin: David Bjornsson <dabb@lolnet.is> | |
| # Author of the Linux port: Alex Chistyakov <alexclear@gmail.com> | |
| PREFIX="servers.`hostname`.zfs" | |
| STATSD_ADDR="YOUR STATSD SERVER" |
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
| files: | |
| "/opt/elasticbeanstalk/hooks/configdeploy/pre/99patchwsgi.py": &file | |
| mode: "000755" | |
| owner: root | |
| group: root | |
| content: | | |
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) |
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
| from fabric.api import env, run | |
| from fabric.contrib.project import rsync_project | |
| try: | |
| from fabfile_local import * | |
| except ImportError, e: | |
| environments = { | |
| "dev": { | |
| "hosts": ["localhost"], | |
| }, |
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
| aws s3api list-objects --bucket=mys3bucket \ | |
| --region=us-west-2 \ | |
| --output=text \ | |
| --prefix=myprefix \ | |
| --query='Contents[].[Key]' | \ | |
| xargs -P4 -I % aws s3api put-object-acl \ | |
| --acl=public-read \ | |
| --region=us-west-2 \ | |
| --bucket=mys3bucket \ | |
| --key='%' |
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
| #!/usr/bin/env python | |
| # Compare a file on S3 to see if we have the latest version | |
| # If not, upload it and invalidate CloudFront | |
| import fnmatch | |
| import os | |
| import boto | |
| import pprint | |
| import re |
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
| import numpy as np | |
| from keras.models import Sequential | |
| from keras.layers.core import Activation, Dense | |
| from keras.optimizers import SGD | |
| X = np.array([[0,0],[0,1],[1,0],[1,1]], "float32") | |
| y = np.array([[0],[1],[1],[0]], "float32") | |
| model = Sequential() | |
| model.add(Dense(2, input_dim=2, activation='sigmoid')) |
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
| public class EnumMapper : IDisposable | |
| { | |
| readonly Dictionary<Type, Dictionary<string, object>> _stringsToEnums = | |
| new Dictionary<Type, Dictionary<string, object>>( ) ; | |
| readonly Dictionary<Type, Dictionary<int, string>> _enumNumbersToStrings = | |
| new Dictionary<Type, Dictionary<int, string>>( ) ; | |
| readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim( ) ; |
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
| <html> | |
| <head> | |
| <title>A Trello Dashboard</title> | |
| <link rel="stylesheet" media="screen" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1>Trello Dashboard</h1> | |
| <form class="form-horizontal" id="boards_form"> |