Skip to content

Instantly share code, notes, and snippets.

View cer's full-sized avatar

Chris Richardson cer

View GitHub Profile
@cer
cer / omnigraffle-export.sh
Last active January 12, 2021 03:41
Bash/Applescript to export Omnigraffle file
#! /bin/bash
# FORMAT is PNG, SVG, ...
FORMAT=${1?}
INPUT="$(pwd)/${2?}"
OUTPUT="$(pwd)/${3?}"
tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
@cer
cer / omnigraffle-export.scpt
Created January 11, 2021 22:00
Applescript for exporting omnigraffle file as PNG
on convertGraffleFile(graffleFile, outputFile)
tell application "OmniGraffle"
close every document
open graffleFile
tell front document to export as "PNG" to POSIX file outputFile scope all graphics
close front document
end tell
end convertGraffleFile
on run argv
java.net.UnknownHostException: customerservice: Name or service not known
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_252]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Assembly trace from producer [reactor.core.publisher.MonoLift] :
reactor.core.publisher.Mono.create
reactor.netty.resources.PooledConnectionProvider$PooledConnectionAllocator.connectChannel(PooledConnectionProvider.java:219)
Error has been observed at the following site(s):
|_ Mono.create ⇢ at reactor.netty.resources.PooledConnectionProvider$PooledConnectionAllocator.connectChannel(PooledConnectionProvider.java:219)
|_ Mono.from ⇢ at reactor.netty.internal.shaded.reactor.pool.PoolBuilder.from(PoolBuilder.java:59)
|_ ⇢ at reactor.netty.internal.shaded.reactor.pool.DefaultPoolConfig.allocator(DefaultPoolConfig.java:100)
#!/bin/bash -e
curl -s --location https://microservices.io/patterns | \
sed -n -e '/<a href="[/.]/d' -e '/<a href="/!d' -e 's/.*href="//' -e 's/".*//' -e '/http/d' -e '/cn\//d' -e '/./p' | \
sort -u | \
sk | \
sed -e 's?\(.*\)?https://microservices.io/patterns/\1?' | \
pbcopy
#! /bin/bash -e
grep eventuate gradle.properties
fixVersion() {
name=${1?}
version=${2?}
sed -i "" -e "s/${name}=.*/${name}=${version}/" gradle.properties
}
@cer
cer / DefaultController.java
Last active January 14, 2023 18:17
Spring Webflux-based proxying controller
import org.springframework.core.io.buffer.DefaultDataBufferFactory;
import org.springframework.http.MediaType;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.reactive.function.client.WebClient;
@cer
cer / pom.xml
Created February 22, 2017 13:49
Eventuate Local pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.eventuate.examples.mavenexample</groupId>
<version>0.1.0-SNAPSHOT</version>
<artifactId>Maven-Example</artifactId>
<packaging>jar</packaging>
<name>maven example</name>
<repositories>
<repository>
package net.chrisrichardson.getataxi.dispatcher.services;
import net.chrisrichardson.getataxi.dispatcher.domain.DispatcherDriver;
import net.chrisrichardson.getataxi.dispatcher.domain.DriverMother;
import net.chrisrichardson.getataxi.dispatcher.domain.DriverRepository;
import net.chrisrichardson.getataxi.domain.Location;
import net.chrisrichardson.getataxi.domain.events.DriverAcceptedTripEvent;
import net.chrisrichardson.getataxi.domain.events.TripCreatedEvent;
import net.chrisrichardson.getataxi.domain.events.TripOfferedToDriver;
When files are uploaded to CrashPlan, a checksum is generated for the file, but is not verified immediately upon receipt.
These checksum values are logged and checked when archive maintenance is performed on the archive, every 7 days.
If CrashPlan were to verify the checksum for each file upon receipt, this would cause each file's upload to take considerably more time to complete, relatively speaking.
Plus, if the drive that the source data was being backed up from was failing, this could potentially cause the drive to fail much more quickly, as there would be a great deal more disk I/O, caused by the file block verification occurring on a per-file basis, while being backed up.
By default, CrashPlan gathers the data that has been collected by a process known as a file verification scan on a daily basis, and then uses this file block information to analyze the files that exist in the backup archive.
If CrashPlan runs into any files that do not match the checksum, it attempts to self-heal the archive, usually
val children = Set("a", "b", "c")
var knownChildren = Map[String, String]()
val newChildren = Map[String, String]()
for (i <- 1 to 1000*1000) {
if (i % 1000 == 0) println(knownChildren.size)
knownChildren = knownChildren.filterKeys(children.contains) ++ newChildren
}