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 collections import namedtuple | |
from enum import Enum | |
import unittest | |
Status = Enum('Status', 'in_progress win lose') | |
Event = namedtuple("Event", "status selectedLetters lifeLeft secretWordLength knownSecretWord") | |
def reactiveHangman(secretWord, letters): | |
event = init(secretWord) | |
for l in letters: |
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
# User win if all letters in secret_words are used in the guess letters | |
def hangman(secret_word, letters): | |
return not( set(secret_word) - set(letters) ) | |
# hangman('bigbears', ['a','e','i','o','u','c','d','p','r','k','l','j','h']) | |
# >> False | |
# | |
# >>> hangman('bigbears', ['a','e','i','b','r','g','s']) | |
# True |
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/python | |
""" | |
How to Use | |
========== | |
1. Copy json content of hubble dashboard to clipboard | |
1.1 Click on the hamburger menu top right of dashboard | |
1.2 Select "Edit Dashboard" | |
1.3 ⌘-A (select all), ⌘-C (copy) |
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 CoreML | |
import Vision | |
let compiledModelUrl = Bundle.main.url(forResource:"ApplesOranges", withExtension: "mlmodelc") | |
let model = try MLModel(contentsOf: compiledModelUrl!) | |
let vnModel = try VNCoreMLModel(for: model) | |
func classify(_ uiImage: UIImage) throws -> [String]? { | |
let request = VNCoreMLRequest(model: vnModel) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 turicreate as tc | |
# There will be a few 'Unexpected JPEG decode failure' ignore those | |
data = tc.image_analysis.load_images('data/', with_path=True) | |
# Apple Label column to each data based on whether they have the word 'apple' or 'orange' in path | |
data['label'] = data['path'].apply(lambda path: 'apple' if '/apples' in path else 'orange') | |
# Save this information as a frame to use later | |
data.save('apples-oranges.sframe') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
private static final Map<Long, PartitionResult> getPartitionsForUsersPrivate(List<Long> dsids) | |
throws AccountAPIException { | |
BatchLookupPartitionRequest batchLookupPartitionRequest = new BatchLookupPartitionRequest(); | |
for (Long dsid : dsids) { | |
batchLookupPartitionRequest.addDsidServiceTypePair(dsid, ServiceType.CloudDB); | |
} | |
BatchPartitionResponse batchPartitionResponse = | |
PartitionAssignmentAPIFactory.partitionAssignmentAPI().batchLookupDatastore( | |
batchLookupPartitionRequest); |
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
gyp ERR! build error | |
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1 | |
gyp ERR! stack at ChildProcess.onExit (C:\Users\Programmer\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23) | |
gyp ERR! stack at emitTwo (events.js:126:13) | |
gyp ERR! stack at ChildProcess.emit (events.js:214:7) | |
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) | |
gyp ERR! System Windows_NT 6.3.9600 | |
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Programmer\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" | |
gyp ERR! cwd C:\Users\Programmer\Desktop\Toursystem\apiweb\node_modules\node-jasper\node_modules\java | |
gyp ERR! node -v v8.11.2 |
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
// | |
class UI { | |
List<ProgressBar> progressBars; | |
public void updateProgress(int taskNumber, int pct) { | |
progressBars.get(0).setTaskPercent(pct) | |
} | |
} | |
task1 = new Task(ui) { |