Skip to content

Instantly share code, notes, and snippets.

@thejohnfreeman
thejohnfreeman / comment.md
Last active April 3, 2019 19:54
Windows, SSH, Docker Machine

A developer named James Nugent described in a blog post the Packer template he wrote for creating a Windows AMI with OpenSSH installed and configured (by default, there is no SSH server installed or running on the free Windows AMIs owned by Amazon). He had previously shared code for using WinRM to automate a Windows instance.

I used his code to create my own AMI in us-east-2: ami-03247dd53ecd53cba. You can try it out yourself. The SSH user is Administrator.

Sadly, there is a long delay between when an AWS instance launched with this AMI enters the state "running" and when the SSH server on it is running, for the same reason that password data is not immediately available, up to 15 minutes. This is just an unfortunate c

// https://medium.freecodecamp.org/how-to-build-a-github-search-in-react-with-rxjs-6-and-recompose-e9c6cc727e7f
// Last example ends with this:
merge(
of(<h3>Loading...</h3>)
ajax(url).pipe(
pluck('response'),
map(Component),
catchError(error => of(<Error {...error} />))
)
semi = false
singleQuote = true
trailingComma = "all"
function flow(makeGenerator) {
// Return a function that constructs an Observable.
return function(...args) {
return Observable.create(observer => {
// This function won't be called until the observable is subscribed.
const generator = makeGenerator.apply(this, args)
generator.next = action(generator.next)
generator.throw = action(generator.throw)
generator.return = action(generator.return)
return new GeneratorSubscriber(observer, generator)
function spawn(f) {
return async(f)()
}
const logIn = async(function*({ username, password }) {
try {
const token = yield ajax.getJSON(
'https://example.com/login', { username, password })
return { value: token }
} catch (cause) {
return { error: 'Wrong username or password.' }
}
})
class IteratorSubscriber extends Subscriber {
constructor(observer, generator) {
super(observer)
this.generator = generator
this.step('next')
}
step(key, arg) {
// Unsubscribe now.
if (this.subscription) {
function async(makeGenerator) {
// Return a function that constructs an Observable.
return function(...args) {
return Observable.create(observer => {
// This function won't be called until the observable is subscribed.
const generator = makeGenerator.apply(this, args)
return new GeneratorSubscriber(observer, generator)
})
}
}
import {
from,
Observable,
ObservableInput,
Observer,
Subscriber,
Subscription,
} from 'rxjs'
import { take } from 'rxjs/operators'
const typeahead = fromEvent(searchBox, 'input').pipe(
map((e: KeyboardEvent) => e.target.value),
filter(text => text.length > 2),
debounceTime(10),
distinctUntilChanged(),
switchMap(() => ajax('/api/endpoint'))
)
typeahead.subscribe(data => {
// Handle the data from the API