Skip to content

Instantly share code, notes, and snippets.

John Freeman thejohnfreeman

Block or report user

Report or block thejohnfreeman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ViewModels.ts
// Objects.ts
type ObjectOf<T> = {
[key: string]: T;
function map<A, B>(
input: ObjectOf<A>,
f: (a: A, key: string) => B
): ObjectOf<B> {
thejohnfreeman / Dockerfile
Last active Jul 7, 2019
Trying to install anything from Visual Studio in a Docker container
View Dockerfile
# Use the latest release channel.
ADD C:\TEMP\VisualStudio.chman
# Download the Visual Studio Build Tools bootstrapper.
ADD C:\TEMP\vs_buildtools.exe
# Download the Visual Studio Community bootstrapper.
ADD C:\TEMP\vs_community.exe
View gist:d57a570ba6e7ccbd260db6c6778eb97f
In file included from ../../.nih_c/ninja/GNU_7.4.0/Debug/src/soci/include/soci/into-type.h:13:0,
from ../../.nih_c/ninja/GNU_7.4.0/Debug/src/soci/include/soci/blob-exchange.h:12,
from ../../.nih_c/ninja/GNU_7.4.0/Debug/src/soci/include/soci/soci.h:15,
from ../../src/ripple/core/SociDB.h:39,
from ../../src/ripple/core/DatabaseCon.h:24,
from ../../src/ripple/overlay/PeerReservationTable.h:24,
from ../../src/ripple/overlay/impl/PeerReservationTable.cpp:20:
../../.nih_c/ninja/GNU_7.4.0/Debug/src/soci/include/soci/exchange-traits.h: In instantiation of ‘struct soci::details::exchange_traits<ripple::PublicKey>’:
../../.nih_c/ninja/GNU_7.4.0/Debug/src/soci/include/soci/bind-values.h:111:76: required from ‘void soci::details::use_type_vector::exchange_(const soci::details::use_container<const T, void>&, ...) [with T = ripple::PublicKey]’
View CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
project(codegen LANGUAGES CXX)
OUTPUT output.h
COMMAND bash -c "echo copying...\; cp input.h output.h\; echo done!"
DEPENDS input.h
add_custom_target(my_header DEPENDS output.h)
View tests_cleanup.cmake
foreach(test ${tests})
set_tests_properties(${test} PROPERTIES FIXTURES_REQUIRED cleanup_fixture)
add_test(cleanup ...)
set_tests_properties(cleanup PROPERTIES FIXTURES_CLEANUP cleanup_fixture)

how about we use consensus to queue restarts? here's the idea:

A new transaction, call it NodeRestart. A validator submits a NodeRestart txn when it wants to restart. Parameters include a start and end ledger sequence. The meaning is that if a validator's NodeRestart txn is accepted and wins (more on that later), then it promises to shutdown after it validates the start sequence and to return before the end sequence. Other honest validators try to avoid restarting in that window.

Most of the network doesn't care about these txns, so they don't have to be part of the ledger. They get a separate section in proposals. They update a separate shared state. The validators apply these txns to their copy of that state; all other nodes just ignore the txns.

NodeRestart txns signed by anyone outside your UNL are dropped. You propose NodeRestart txns signed by someone outside your UNL only if they appeared in a proposal from a node in your UNL.

Within a transaction set, there may be multiple (and possibly conflictin

thejohnfreeman /
Last active Apr 3, 2019
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

View merge-vs-startwith.js
// Last example ends with this:
catchError(error => of(<Error {...error} />))
View .prettierrc.toml
semi = false
singleQuote = true
trailingComma = "all"
View flow.js
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) = action(
generator.throw = action(generator.throw)
generator.return = action(generator.return)
return new GeneratorSubscriber(observer, generator)
You can’t perform that action at this time.