Skip to content

Instantly share code, notes, and snippets.

@GioF71
GioF71 / pulse-client-uid-1001.conf
Created December 20, 2023 10:52
pulse-client-uid-1001.conf
# Connect to the host's server using the mounted UNIX socket
default-server = unix:/run/user/1001/pulse/native
# Prevent a server running in the container
autospawn = no
daemon-binary = /bin/true
# Prevent the use of shared memory
enable-shm = false
@GioF71
GioF71 / pulse-client-uid-1000.conf
Last active December 20, 2023 10:52
PulseAudio client configuration (user: 1000)
# Connect to the host's server using the mounted UNIX socket
default-server = unix:/run/user/1000/pulse/native
# Prevent a server running in the container
autospawn = no
daemon-binary = /bin/true
# Prevent the use of shared memory
enable-shm = false
@GioF71
GioF71 / dual-dac-multi-config-docker-compose.yaml
Last active March 14, 2022 19:19
Multiple Configurations (aka Players) on two dacs (x20 and dac) with squeezelite-docker
---
version: '3.3'
# More details here https://github.com/GioF71/squeezelite-docker
# This stack configures three players on dac 'x20' and two players on dac 'DAC'
# lms.homelab.com is where my logitech media server is.
# Change the SQUEEZELITE_SERVER_PORT value according to your network configuration
# Remember to specify SQUEEZELITE_SERVER_PORT or discovery will not find all the configured players
services:
@GioF71
GioF71 / single-dac-multi-config-docker-compose.yaml
Last active March 14, 2022 19:20
Multiple Configurations (aka Players) on the same dac (x20) with squeezelite-docker
---
version: '3.3'
# More details here https://github.com/GioF71/squeezelite-docker
# This stack configures three players on dac 'x20'
# lms.homelab.com is where my logitech media server is.
# Change the SQUEEZELITE_SERVER_PORT value according to your network configuration
# Remember to specify SQUEEZELITE_SERVER_PORT or discovery will not find all the configured players
services:
@GioF71
GioF71 / gist:dfb9736444fcc8ff06e7bb3ead7d41fe
Created June 17, 2021 14:51
comparison-aoc-2020-combinatory-naive-against-less-naive.txt
127642310
127642310
127642310
Combinatory: 52.274, Naive: 14.476 msec, NonNaive: 4.410 msec
private static long nonNaive(List<Long> values, long sum) {
Long result = null;
List<Long> sorted = values.stream().filter(x -> x <= (SUM - 2)).collect(Collectors.toList());
sorted.sort(Comparator.naturalOrder());
for (int i = 0; result == null && i < sorted.size() - 2; ++i) {
long a = sorted.get(i);
boolean offRange = false;
for (int j = i; !offRange && result == null && j < sorted.size() - 1; ++j) {
long b = sorted.get(j);
long partial = a + b;
private static <T> List<T> readFile(
String fileName,
Supplier<List<T>> listSupplier,
Function<String, T> converter) throws IOException {
List<T> list = listSupplier.get();
FileInputStream inputStream = null;
try {
ClassLoader classLoader = Puzzle01.class.getClassLoader();
File file = new File(classLoader.getResource(fileName).getFile());
inputStream = new FileInputStream(file);
Given the list of numbers, find the three numbers (a, b, c) that sum to 2020 and return (a*b*c)
1322
1211
1427
1428
1953
1220
1629
1186
1354
1776