Skip to content

Instantly share code, notes, and snippets.

View joel113's full-sized avatar

Johannes Ehm joel113

View GitHub Profile
@joel113
joel113 / gist:7b36d41c87e70d006a2a4d082af8e084
Created September 16, 2023 16:32 — forked from jauderho/gist:6b7d42030e264a135450ecc0ba521bd8
HOWTO: Upgrade Raspberry Pi OS from bullseye to bookworm
sudo apt-get update && sudo apt-get dist-upgrade
sudo sed -i -e 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i -e 's/bullseye/bookworm/g' /etc/apt/sources.list.d/raspi.list
sudo apt update
sudo apt -y full-upgrade
sudo apt -y autoremove
sudo apt -y clean
sudo reboot
#
# remove old config files after doing sanity checks
@joel113
joel113 / AdbCommands
Created May 29, 2022 11:10 — forked from ernestkamara/AdbCommands
Adb useful commands list
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
== Shell
@joel113
joel113 / Client.java
Created February 15, 2022 19:48 — forked from ebarlas/Client.java
package test;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Arrays;
@joel113
joel113 / forcomp.scala
Created October 8, 2021 20:59 — forked from linasm/forcomp.scala
Comprehending the For-Comphension talk, Vilnius, Nov 2018
sealed abstract class Perhaps[+A] {
def foreach(f: A => Unit): Unit
def map[B](f: A => B): Perhaps[B]
def flatMap[B](f: A => Perhaps[B]): Perhaps[B]
def withFilter(f: A => Boolean): Perhaps[A]
}
case class YesItIs[A](value: A) extends Perhaps[A] {
override def foreach(f: A => Unit): Unit = f(value)
override def map[B](f: A => B): Perhaps[B] = YesItIs(f(value))
@joel113
joel113 / KafkaInZioQueuesFibers.scala
Created August 29, 2021 14:23 — forked from mtsokol/KafkaInZioQueuesFibers.scala
Build your own Kafka in ZIO - Queues & Fibers
import zio._
import zio.random._
import zio.console._
import zio.duration._
object Main extends App {
override def run(args: List[String]) = program.exitCode
sealed trait Diagnostic
@joel113
joel113 / kinesis-get-records.sh
Created April 28, 2021 18:14 — forked from codemedic/kinesis-get-records.sh
Get records from a AWS Kinesis Data Stream. It allows you to start iterating from a time in the past.
#!/usr/bin/env bash
if ! aws_bin="$(which aws)" 2>/dev/null; then
echo "aws cli is missing; you can get it from https://aws.amazon.com/cli/"
exit 1
fi
if ! jq_bin="$(which jq)" 2>/dev/null; then
echo "jq is missing; you can get it from https://stedolan.github.io/jq/"
exit 1
@joel113
joel113 / CirceSupport.scala
Created January 29, 2021 16:32 — forked from mattroberts297/CirceSupport.scala
Akka HTTP Circe Custom Marshaller and Unmarshaller
import io.circe._
import io.circe.parser._
import io.circe.syntax._
import akka.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller}
import akka.http.scaladsl.model.{ContentTypeRange, HttpEntity}
import akka.http.scaladsl.model.MediaTypes.`application/json`
import akka.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller}
import scala.concurrent.Future