Skip to content

Instantly share code, notes, and snippets.

View 46bit's full-sized avatar
🏳️‍🌈

Miki Mokrysz 46bit

🏳️‍🌈
View GitHub Profile
@46bit
46bit / gist:3909b7c3d7a0218f578e9138e98b8ec7
Last active August 31, 2017 15:35
`/bin/bash: line 0: exec: ssh_with_options: not found`
#!/bin/bash
if [ -z "${VM_IP:-}" ]; then
echo "Error: IPv4 address of the gateway VM must be provided as VM_IP env variable."
exit 1
fi
BOSH_KEY=/tmp/bosh_id_rsa.$RANDOM
DEPLOY_KEY=/tmp/deploy_id_rsa.$RANDOM
trap 'rm -f ${BOSH_KEY} ${DEPLOY_KEY}' EXIT

Markers

  • A marker is represented by a <circle …>.
  • Markers must have a consistent colour such that they can be automatically identified.
  • A marker connects to one or more paths.
  • A marker that does not connect to a path can be considered invalid.
  • A marker connects to a path if the path's line intersects with the marker's circle. Connection location
  • If a path goes through the centre of the circle, the connection is at the centre.
  • If a path goes off-centre through the circle, the connection is at the closest approach.

How the CDN Broker impacts the cf.cc.job_queue job queue

In Provision, the CDN broker starts the creation of a CloudFront instance. The broker then takes advantage of Cloud Foundry regularly calling LastOperation, and performs further work during those calls. The work it does once the CloudFront instance is available is quite extended.

LastOperation is supposed to respond very quickly rather than doing substantial work. The cf.cc.job_queue job queue runs jobs that check LastOperation, and block while waiting for the response. Slow responses therefore impact the entire queue. This queue is important as it also processes asynchronous operations for the cf CLI.

How LastOperation behaves when Provisioning

Procedure

@46bit
46bit / main.rs
Last active June 10, 2017 19:42 — forked from alexcrichton/main.rs
extern crate futures;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
use std::sync::Arc;
use std::time::{Instant, Duration};
use futures::{Async, Future};
use futures::executor::{self, Spawn};
use futures::task::Unpark;
fn query<R>(&self,
query: QueryForReply<Id, Definition>,
reply_rx: oneshot::Receiver<R>)
-> Box<Future<Item = R, Error = bool>>
where R: Send + 'static
{
self.query_tx
.clone()
.send(query)
.map_err(|_| false)
@46bit
46bit / cookiecaster-microservices.md
Last active September 17, 2020 20:19
Rebuilding http://www.cookiecaster.com as a set of microservices to learn.

Cookiecaster in microservices

Key

  • deployable microservice
    • endpoint
      • parameters

Sketch

from enum import Enum, unique
@unique
class Direction(Enum):
north, east, south, west = range(1, 5)
def offset(self):
if self is Direction.north:
return [0, -1]
@46bit
46bit / mat.hs
Last active April 19, 2017 19:11
import Prelude hiding (take)
import Data.List (sort)
import Test.LeanCheck
import Test.LeanCheck.Utils
import Test.FitSpec
class Set s where
empty :: s
single :: Eq a => a -> s
fortysix@electryon:sirpent-rust ∴ cargo run
Compiling sirpent v0.1.1 (file:///Users/fortysix/forest/sirpent-team/sirpent-rust)
error[E0277]: the trait bound `futures::stream::Iter<std::iter::Map<std::iter::Filter<std::vec::IntoIter<comms::Client<std::string::String, tokio_io::codec::Framed<tokio_core::net::TcpStream, sirpent::net::MsgCodec>>>, fn(&comms::Client<std::string::String, tokio_io::codec::Framed<tokio_core::net::TcpStream, sirpent::net::MsgCodec>>) -> bool {<comms::Client<I, C>><std::string::String, tokio_io::codec::Framed<tokio_core::net::TcpStream, sirpent::net::MsgCodec>>::is_connected}>, fn(comms::Client<std::string::String, tokio_io::codec::Framed<tokio_core::net::TcpStream, sirpent::net::MsgCodec>>) -> std::result::Result<comms::Client<std::string::String, tokio_io::codec::Framed<tokio_core::net::TcpStream, sirpent::net::MsgCodec>>, _> {std::result::Result<comms::Client<std::string::String, tokio_io::codec::Framed<tokio_core::net::TcpStream, sirpent::net::MsgCodec>>, _>::Ok}>>: futures::Fut