Skip to content

Instantly share code, notes, and snippets.

@tg44
tg44 / gist:ddb5e911b36838f580084e45e51a15a2
Created July 16, 2016 21:09
adb shell dumpsys | grep Width
C:\adb\src
λ adb shell dumpsys | grep Width
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
options=Bundle[{appWidgetMaxHeight=492, appWidgetCategory=1, appWidgetMaxWidth=492, appWidgetMinHeight=306, appWidgetMinWidth=336}]
options=Bundle[{appWidgetMaxHeight=111, appWidgetCategory=1, appWidgetMaxWidth=492, appWidgetMinHeight=64, appWidgetMinWidth=336}]
options=Bundle[{appWidgetMaxHeight=492, appWidgetCategory=1, appWidgetMaxWidth=492, appWidgetMinHeight=306, appWidgetMinWidth=336}]
@tg44
tg44 / CombineLatest.scala
Last active July 27, 2018 06:09
Quick implementation of the CombineLatest RX operator in AkkaStreams
import akka.actor.ActorSystem
import akka.stream._
import akka.stream.scaladsl.{Flow, GraphDSL, Keep, RunnableGraph, Sink, Source}
import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
import akka.testkit.TestKit
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike}
import scala.concurrent.Await
class CombineLatest[A, B]
@tg44
tg44 / ResponsTimeLoggerActor.scala
Last active December 15, 2017 13:59
ResponseTimeLoggerActor
object ResponseTimeLoggerActor {
case object LogMeasures
}
trait ResponseTimeLoggerActor {
x: Actor =>
implicit val executionContext: ExecutionContextExecutor
@tg44
tg44 / gist:ea5608bed083b62629eef023282c33f2
Created November 14, 2018 20:46
Android emulator minimum CLI install for Mac
/*
If you want to use Android studio ever, go and download + install that! (Huge but reliable!)
Min req:
- brew installed
- java installed:
brew cask install caskroom/versions/java8
The steps below sometimes requires user interaction (like accepting licenses)!
*/
@tg44
tg44 / humidity-sensor-test.ino
Last active February 3, 2019 09:33
Wemos D1 mini with BME280 test
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <SPI.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
void setup(void) {
@tg44
tg44 / light-sensor-test-v2.ino
Last active February 3, 2019 09:35
Wemos D1 mini TSL2561
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>
#include <SPI.h>
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
void setup(void) {
Serial.begin(9600);
Serial.println("");
@tg44
tg44 / Makefile
Created May 30, 2019 17:26
home-server config files
file-compose=docker-compose -f file-server.compose.yml -p file-server
hassio-compose=docker-compose -f hassio.compose.yml -p hassio-server
default: help
fup: ## Spin up services
$(file-compose) up -d
fstop: ## Stop services
$(file-compose) stop
@tg44
tg44 / SpoiwoGridExamples.scala
Created January 15, 2020 16:20
Spoiwo Grid Examples
"Grid" should {
import com.norbitltd.spoiwo.natures.xlsx.Model2XlsxConversions._
def generateGrid(n: Int, m: Int, c: Color) = {
val cell = Cell("").withStyle(CellStyle(fillForegroundColor = c, fillPattern = CellFill.Solid))
val row = Row().withCells(Seq.fill(m)(cell))
Grid { f =>
Seq.fill(n)(row)
}
}
@tg44
tg44 / PrettyDuration.scala
Created June 7, 2020 09:35
Helper to pretty print scala Duration
import concurrent.duration._
import scala.annotation.tailrec
object PrettyDuration {
val timeUnitList: List[TimeUnit] =
DAYS ::
HOURS ::
MINUTES ::
SECONDS ::
MILLISECONDS ::
@tg44
tg44 / README.md
Last active April 12, 2023 20:16
Cheap IP camera video converter

install nodejs 12

run with node app.js cameraRootDir

Almost works with Blitzwolf BW-SHC2 (no audio for me).

Not tested on windows, but probably changing the ffmpeg in the first two function-returns to something like ffmpeg.exe will make this work.

The script will recursively walk on every sudir, group the files ased on parent dir,