Skip to content

Instantly share code, notes, and snippets.

View krasserm's full-sized avatar

Martin Krasser krasserm

View GitHub Profile
@squadbox
squadbox / cool_gpu2.sh
Last active December 6, 2023 05:34
A script to control Nvidia GPU fan speed on headless (non-X) linux nodes
#!/bin/bash
# cool_gpu2.sh This script will enable or disable fixed gpu fan speed
#
# Description: A script to control GPU fan speed on headless (non-X) linux nodes
# Original Script by Axel Kohlmeyer <akohlmey@gmail.com>
# https://sites.google.com/site/akohlmey/random-hacks/nvidia-gpu-coolness
#
# Modified for newer drivers and removed old work-arounds
@bmc
bmc / StaticFile.scala
Last active September 3, 2021 20:08
I needed code to serve static files from an Akka HTTP server. I wanted to use fs2 to read the static file. Michael Pilquist recommended using streamz to convert from an fs2 Task to an Akka Source. This is what I came up with. (It does actually work.)
object StaticFile {
// Various necessary imports. Notes:
//
// 1. fs2 is necessary. See https://github.com/functional-streams-for-scala/fs2
// 2. streamz is necessary. See https://github.com/krasserm/streamz
// 3. Apache Tika is used to infer MIME types from file names, because it's more reliable and
// fully-featured than using java.nio.file.Files.probeContentType().
//
// If using SBT, you'll want these library dependencies and resolvers:
@maciekciolek
maciekciolek / gist:c645e28cc708b26177eb1444d077d09a
Created June 5, 2016 19:13
Example of KafkaBatchProducer
import java.nio.ByteBuffer
import java.util.concurrent.TimeUnit
import org.apache.kafka.clients._
import org.apache.kafka.common.metrics.{MetricConfig, Metrics, MetricsReporter}
import org.apache.kafka.common.network.Selector
import org.apache.kafka.common.protocol.ApiKeys
import org.apache.kafka.common.record.{CompressionType, MemoryRecords}
import org.apache.kafka.common.requests.{ProduceRequest, RequestSend}
import org.apache.kafka.common.utils.SystemTime