Skip to content

Instantly share code, notes, and snippets.

View michaelahlers's full-sized avatar

Michael Ahlers michaelahlers

View GitHub Profile
@juanbrujo
juanbrujo / PlayStationBIOSFilesNAEUJP.md
Last active May 7, 2024 17:59
Files for PlayStation BIOS Files NA-EU-JP
@michaelahlers
michaelahlers / glacier-bulk-restore.sh
Last active April 4, 2019 16:27
Bulk restore-request of objects in S3.
#!/bin/bash
BUCKET_NAME="my-bucket"
KEY_PREFIX="my-key-prefix"
DAYS = "10"
aws s3 ls --recursive "s3://$BUCKET_NAME/$KEY_PREFIX" |\
awk '{$1=$2=$3=""; print $0}' |\
sed 's/^[[:space:]]*//g' |\
tr '\n' '\0' |\
@laughedelic
laughedelic / sbt-dependency-management-guide.md
Last active April 25, 2024 19:06
Explicit dependency management in sbt

Some of these practices might be based on wrong assumptions and I'm not aware of it, so I would appreciate any feedback.

  1. avoiding some dependency conflicts:

    • install sbt-explicit-dependencies globally in your ~/.sbt/{0.13,1.0}/plugins/plugins.sbt
    • run undeclaredCompileDependencies and make the obvious missing dependencies explicit by adding them to libraryDependencies of each sub-project
    • (optionally) run unusedCompileDependencies and remove some obvious unused libraries. This has false positives, so ; reload; Test/compile after each change and ultimately run all tests to see that it didn't break anything
    • (optionally) add undeclaredCompileDependenciesTest to the CI pipeline, so that it will fail if you have some undeclared dependencies
  2. keeping dependencies up to date and resolving conflicts:

    • install sbt-updates globally in your `~/.sbt/{0.13,1.0}/plugins/plugins.
@mtgto
mtgto / repositories
Created January 30, 2018 00:10
[~/.sbt/repositories] Use google's maven central mirror, prevent to redirect for lightbend repository.
# http://www.scala-sbt.org/1.x/docs/Launcher-Configuration.html
# https://storage-download.googleapis.com/maven-central/index.html
[repositories]
local
maven-central: https://maven-central-asia.storage-download.googleapis.com/repos/central/data/
lightbend-ivy-releases: https://dl.bintray.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
#typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sonatype-snapshots: https://oss.sonatype.org/content/repositories/snapshots

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@alexellis
alexellis / timelapse.md
Created March 9, 2017 08:48 — forked from porjo/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

@kolemannix
kolemannix / TaggedPlayJsonExample.scala
Last active November 15, 2016 13:58
Dynamically sanitizing Strings (XSS concerns) based on type tags
import scalaz.{ @@, Tag }
import org.apache.commons.lang.StringEscapeUtils
import org.joda.time.DateTime
import play.api.libs.json._
trait DomRenderable
def RenderableString(s: String): String @@ DomRenderable = Tag[String, DomRenderable](s)
@kevin-smets
kevin-smets / 1_kubernetes_on_macOS.md
Last active May 5, 2024 10:12
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@Aivean
Aivean / Glob.scala
Created September 10, 2016 20:26
Glob matcher implementation in Scala
case class State(matches: String => Boolean, optional: Boolean)
def matcher(pattern: String): String => Boolean = {
val states = pattern.split("/").toList.map {
case "**" => State(_ => true, true)
case s =>
val r = s.replaceAllLiterally("*", ".*").r
State(r.unapplySeq(_).isDefined, false)
@ViktorNova
ViktorNova / rotate-video.sh
Created August 8, 2016 21:33
Rotate a video with FFmpeg (100% lossless, and quick)
$INPUTVIDEO='input.mp4'
$OUTPUTVIDEO='output.mp4'
ffmpeg -i $INPUTVIDEO -metadata:s:v rotate="-90" -codec copy $OUTPUTVIDEO