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
| Import-Module WebAdministration | |
| Set-WebConfigurationProperty '/system.applicationHost/applicationPools/applicationPoolDefaults/recycling' -Name logEventOnRecycle -value "Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory" | |
| $pools = Get-ChildItem iis:\apppools | |
| foreach ($pool in $pools){ | |
| $poolname = $pool.Name | |
| Set-ItemProperty iis:\apppools\$poolname -name recycling -value @{logEventOnRecycle="Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory"} | |
| } |
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
| with test_1 as | |
| ( | |
| select regexp_replace('ab mori sherbim konf modemit te riab ka sherbim u verifikua.____________________.Problem Description.11.01.2016 15:06:53 U07996..abonenti nuk ka sherbim.____________________.Problem Description.11.01.2016 09:56:38 SERVICEDESK..ab mori sherbim konf modemit te ri.____________________.Problem Description.10.01.2016 10:01:24 U09148..ab ska sherbim ne ne internet' ,'(._+.Problem Description.)','|') replaced_str | |
| from dual | |
| ) | |
| select regexp_substr(replaced_str,'[^|]+',1,level) | |
| from test_1 | |
| connect by level <= length( regexp_substr(replaced_str,'[^|]+',1)) + 1 |