Client:
username = "alice"
secretKey = "12345"
method = GET
url = "https://example.com/private"
Client sends what it essentially this HTTP request:
method = GET
URL = "https://example.com/private"
#!/bin/bash | |
# Assumes .jpg files, fix that if you need to | |
input="$1" | |
output=$(basename -s .jpg "$input") | |
output="${output}-darker.jpg" | |
convert "$input" -fill black -colorize 35 -quality 90 "$output" |
import java.time.Clock | |
import java.time.Instant | |
object BenchTime { | |
val clock = Clock.systemUTC | |
def bench(fn: () => Unit, iterations: Int = 1000000) = { | |
val start = System.nanoTime | |
Range(0,iterations).foreach( _ => fn() ) | |
val end = System.nanoTime |
import java.time._ | |
import java.time.format.{DateTimeFormatter, DateTimeFormatterBuilder} | |
import java.time.temporal.ChronoField._ | |
// This one doesn't work, because Mysql can return five-digits of precision, if the sixth digit was 0 | |
val badFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS") | |
val mysqlFormatter = new DateTimeFormatterBuilder().appendValue(YEAR, 4) | |
.appendLiteral('-') |
#include "Arduino.h" | |
#include <stdlib.h> | |
#include <FastLED.h> | |
// Was built against version 3.1 | |
#define LEDPIN 0 | |
#define LEDPIN2 1 | |
#define LEDCOUNT 420 | |
// Unused unless I go for non-mirroring: | |
#define LEDS_PER_STRIP 210 |
#!/bin/bash | |
# Requires ffmpeg - brew install ffmpeg | |
if [[ -z "$1" ]]; then | |
echo "Usage: $0 Screen\\ Recording\\ at\\ 2021-01-21.mov" | |
exit 1 | |
fi | |
basefilename=$(basename "$1" .mov) | |
outputname="$basefilename.mp4" | |
nice ffmpeg \ |
#!/bin/bash | |
docker container run -u 1000 --rm -v "$PWD:/mnt" \ | |
-v "$SRC:/input.mov:ro" \ | |
alfg/ffmpeg \ | |
nice ffmpeg -hide_banner \ | |
-loglevel warning \ | |
-i "/input.mov" \ | |
-c:v libx264 -preset medium -profile:v high -level 4.2 -crf 21 \ | |
"/mnt/output.mp4" | |
import java.util.concurrent.TimeUnit | |
import akka.actor.typed.Behavior | |
import akka.actor.typed.scaladsl.{Behaviors, TimerScheduler} | |
import scala.concurrent.duration._ | |
class ButterflyActor( | |
timers: TimerScheduler[TriggerMessage], | |
) { |
Client:
username = "alice"
secretKey = "12345"
method = GET
url = "https://example.com/private"
Client sends what it essentially this HTTP request:
method = GET
URL = "https://example.com/private"
import org.jruby.embed.ScriptingContainer | |
object RubyRunner { | |
def rubyScript = io.Source.fromFile("demo.rb").mkString | |
def main(args: Array[String]): Unit = { | |
val result = runScript(rubyScript, "hello world") | |
println(s"Ruby returned: $result") | |
} |
// rh = relative humidity, in range from 0.0 to 1.0 | |
// t = temperature (celcius), typically in range from -10 to 50 | |
// v = wind speed (m/s) | |
def vp(rh: Double, t: Double) = rh * 6.105 * Math.exp( (17.27 * t) / (237.7 + t)) | |
def at(t: Double, rh: Double, v: Double) = t + (0.33 * vp(rh, t)) - (0.7 * v) - 4.00 | |