Skip to content

Instantly share code, notes, and snippets.

@momania
momania / gist:1379932
Created November 20, 2011 07:35
CoffeePot Cake
object CoffeePot extends App {
ComponentRegistry.coffeeWarmer.trigger
}
trait OnOffDevice {
def on: Unit
def off: Unit
}
trait SensorDevice {
@momania
momania / cool_gpu2.sh
Last active February 7, 2018 10:58 — forked from squadbox/cool_gpu2.sh
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 <[email protected]>
# https://sites.google.com/site/akohlmey/random-hacks/nvidia-gpu-coolness
#
# Modified for newer drivers and removed old work-arounds
@momania
momania / nvidia-smi-exporter.service
Last active February 22, 2018 13:44
Setup of nvidia smi exporter for prometheus
[Unit]
Description=nvidia smi epxorter
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/nvidia-smi-exporter
[Install]
WantedBy=multi-user.target
@momania
momania / DateUtil.scala
Created January 14, 2020 17:15
Simple Scala date util to get all week days between two given dates
import java.time.{DayOfWeek, LocalDate}
object DateUtil {
@inline private def isWeekend(d: LocalDate): Boolean = {
d.getDayOfWeek == DayOfWeek.SATURDAY || d.getDayOfWeek == DayOfWeek.SUNDAY
}
def businessDayStream(from: LocalDate, to: LocalDate): Stream[LocalDate] = {
Stream.iterate(from)(_.plusDays(1)).filterNot(isWeekend).takeWhile(_.isBefore(to))