Skip to content

Instantly share code, notes, and snippets.

import java.lang.ref.Cleaner;
public class ExternalCleaner {
public static void main(String... args) throws Exception {
while (true) {
SensitiveData data = new SensitiveData();
StateCleaner cleaner = new StateCleaner(data);
Thread.sleep(100);
import java.lang.ref.Cleaner;
public class InternalCleaner {
public static void main(String... args) throws Exception {
while (true) {
SensitiveData data = new SensitiveData();
Thread.sleep(100);
System.gc();
@daschl
daschl / a.md
Created July 1, 2022 06:36
Couchbase / Reactor Classpath Issues

Overview

The issue we are running into with the couchbase spark connector under databricks is that there seem to be classpath issues which based on my analysis and limited understandung of the underlying runtime should not happen.

I'm sharing the rough details below, if someone needs access to couchbase cloud credentials to try and reproduce please just ping me directly @daschl on twitter and I'm more than happy to provide those.

Background

The Connector uses the Couchbase Scala SDK underneath which has a direct dependency on project reactor and makes use of it quite heavily.

Looking at the classpath, it looks like there is more than one reactor version there:

@daschl
daschl / d2.rs
Created January 14, 2021 21:26
d2.rs
//! Experimental code for the touch screen display.
#![no_main]
#![cfg_attr(not(test), no_std)]
#[allow(unused_imports)]
use defmt_rtt as _;
use display_interface::DataFormat::U16BEIter;
use display_interface::WriteOnlyDataCommand;
use display_interface_spi::SPIInterfaceNoCS;
#![no_main]
#![cfg_attr(not(test), no_std)]
#[allow(unused_imports)]
use defmt_rtt as _;
#[allow(unused_imports)]
use nrf52840_hal as _;
use nrf52840_hal::gpio::{Level, Output, Pin, PushPull};
use nrf52840_hal::prelude::OutputPin;
@daschl
daschl / display.rs
Last active October 25, 2020 16:07
display.rs
#![no_main]
#![no_std]
use defmt_rtt as _;
use nrf52840_hal as _; // memory layout // global logger
use embedded_hal::digital::v2::OutputPin;
use nrf52840_hal::gpio::{p0, Level, Output, Pin, PushPull};
use nrf52840_hal::pac::{Peripherals, SPIM0, TIMER0};
use nrf52840_hal::prelude::*;
//! Helps to wrap plugins into commands for direct inclusion
use nu_plugin::Plugin;
use nu_cli::{CommandArgs, CommandRegistry, OutputStream, WholeStreamCommand};
use async_trait::async_trait;
use nu_protocol::Signature;
use nu_errors::ShellError;
pub struct PluginCommand<P> {
signature: Signature,
package org.testcontainers.couchbase;
import com.github.dockerjava.api.command.InspectContainerResponse;
import com.github.dockerjava.api.model.ContainerNetwork;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.JsonNode;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import org.testcontainers.shaded.okhttp3.Credentials;
import org.testcontainers.shaded.okhttp3.FormBody;
package org.testcontainers.couchbase;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseCluster;
import com.couchbase.client.java.document.JsonDocument;
import com.couchbase.client.java.document.json.JsonObject;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
import org.junit.ClassRule;
> cbq -u Administrator -p password --script "select * from `travel-sample` limit 10" -q | from-json | get results.travel-sample | sort-by name
━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━┯━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━
callsign │ country │ iata │ icao │ id │ name │ type
──────────┼───────────────┼──────┼──────┼────┼─────────────┼─────────
MILE-AIR │ United States │ Q5 │ MLA │ 10 │ 40-Mile Air │ airline
━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━┷━━━━━━┷━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━
> cbq -u Administrator -p password --script "select * from `travel-sample` limit 10" -q | from-json | get results | get travel-sample | sort-by name
━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━┯━━━━━━┯━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━
# │ callsign │ country │ iata │ icao │ id │ name │ type