csrutil disable
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
extension KeyedDecodingContainer { | |
func decode<T: Decodable, Inner: CodingKey>(_ type: T.Type, forKey key: KeyedDecodingContainer.Key, innerKey: Inner) throws -> [T] { | |
var array = try nestedUnkeyedContainer(forKey: key) | |
var items: [T] = [] | |
while !array.isAtEnd { | |
let container = try array.nestedContainer(keyedBy: Inner.self) | |
let item = try container.decode(T.self, forKey: innerKey) | |
items.append(item) | |
} |
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
''' | |
Alex Walczak, 2017 | |
Example of barrier implementation using TensorFlow shared variables | |
across a multi-machine cluster. | |
All workers synchronize on the barrier, copy global parameters to local versions, | |
and increment the global parameter variable asynchronously. | |
On each worker run: |
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 | |
import Gridicons | |
import UIKit | |
import WebKit | |
class WebViewController: UIViewController { | |
let webView = WKWebView() | |
let progressView = WebProgressView() | |
let toolbar = UIToolbar() | |
let titleView = NavigationTitleView() |
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 -vv
sets the default remote branch for the current local branch.
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. |
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
#!/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
""" 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 |