-
With a single command, skip the hassle and get your app running in the cloud effortlessly.
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
| struct Node<T> { // error: recursive value type 'Node<T>' is not allowed | |
| var child: Node? | |
| var value: T | |
| init(value: T, child: Node? = nil) { | |
| self.value = value | |
| self.child = child | |
| } | |
| } |
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 UIKit | |
| import PlaygroundSupport | |
| struct StringConstants { | |
| static let bullet1 = "This is a small string." | |
| static let bullet2 = "This is more of medium string with a few more words etc." | |
| static let bullet3 = "Well this is certainly a longer string, with many more words than either of the previuos two strings." | |
| } | |
| typealias ParagraphData = (bullet: String, paragraph: String) |
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
| # Working example for my blog post at: | |
| # https://danijar.github.io/structuring-your-tensorflow-models | |
| import functools | |
| import tensorflow as tf | |
| from tensorflow.examples.tutorials.mnist import input_data | |
| def doublewrap(function): | |
| """ | |
| A decorator decorator, allowing to use the decorator to be used without |
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 Foundation | |
| extension String { | |
| func replaceCharactersFromSet(characterSet: NSCharacterSet, replacementString: String) -> String { | |
| let scanner = NSScanner(string: self) | |
| scanner.charactersToBeSkipped = nil | |
| let sanitizedString = NSMutableString(capacity: self.characters.count) | |
| while(!scanner.atEnd) { |
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
| """ Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
| import numpy as np | |
| import cPickle as pickle | |
| import gym | |
| # hyperparameters | |
| H = 200 # number of hidden layer neurons | |
| batch_size = 10 # every how many episodes to do a param update? | |
| learning_rate = 1e-4 | |
| gamma = 0.99 # discount factor for reward |
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 | |
| echo "Getting list of Availability Zones" | |
| all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort) | |
| all_az=() | |
| while read -r region; do | |
| az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort) | |
| while read -r az; do |
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
| // | |
| // ViewController.swift | |
| // Example | |
| // | |
| // Created by John DeLong on 5/11/16. | |
| // Copyright © 2016 delong. All rights reserved. | |
| // | |
| import UIKit |
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
| $ ecs-run | |
| Run a Docker container with the same configuration as an ECS service. | |
| It uses the same image and environment variables of the ECS task definition. | |
| Supported AWS CLI environment variables: | |
| - AWS_ACCESS_KEY_ID: AWS access key. | |
| - AWS_SECRET_ACCESS_KEY: AWS secret key. | |
| - AWS_SESSION_TOKEN: session token. | |
| - AWS_DEFAULT_REGION: AWS region. |
git branch --set-upstream-to <remote-branch>
# example
git branch --set-upstream-to origin feature-branch
# show up which remote branch a local branch is tracking
git branch -vvsets the default remote branch for the current local branch.