Skip to content

Instantly share code, notes, and snippets.

View ScalaWilliam's full-sized avatar
🏠
Working from home

ScalaWilliam ScalaWilliam

🏠
Working from home
View GitHub Profile
@ScalaWilliam
ScalaWilliam / missing.md
Last active July 17, 2021 02:59
Things yet to work in Scala 3 / sadly why I'm having difficulty migrating to it
@ScalaWilliam
ScalaWilliam / ResourceTimer.scala
Last active March 7, 2021 21:49
To debug how quickly different resources start up -- hugely important for application start up time. Used in https://www.scala-algorithms.com/
import cats.effect.{IO, Resource}
import io.chrisdavenport.log4cats.SelfAwareStructuredLogger
import java.time.{Duration, Instant}
object ResourceTimer {
implicit class RichResource[A](resource: Resource[IO, A]) {
def measured(
def of[F[_]](pf: PartialFunction[Request[F], HttpRoutes[F]])(
implicit F: Sync[F]): HttpRoutes[F] = {
Kleisli { req: Request[F] =>
OptionT.fromOption[F](pf.lift(req).map(_.apply(req))).flatMap(identity)
}
}
// but we'd like to do multiple PartialFunctions here actually?
// and a PF is already a Kleisli of Option
def apply[F[_]: Monad, UserId](
java -jar sjk-plus.jar mxdump --pid $(jps|grep ProdSe|cut -f 1 -d ' ')|grep -A4 inters |grep -A4 reader^C

the concept is to do the appropriate thing for the appropriate time instead of guessing what the truth would be 2 years down the line, we try different things within 1 month timeframe or so then we can align more closely with the truth and the right thing all the time e.g. achievements was really really good at the beginning. listing who achieved what on the homepage is quite nice, but at some point we'll have achievements coming in every 5 minutes so we'll remove that information, because it's no good any more it's a conversation. And conversation is transitive, temporary, ephemeral but you can't get to the conclusion without having the conversation and going through the motions, the immediate steps 😀

ScalaWilliam Jan 24 09:08 http://actionfps.com/players/ page not useful any more, we should remove it and replace it with something different but it was very useful at the beginning @lucasgautheron I see 4 outstanding pull requests, planning to merge them at somepoint? 😀 just maybe not #111 o

@ScalaWilliam
ScalaWilliam / http-caching.md
Created June 26, 2017 00:34
Some attempts at seeing how Blogger handles HTTP caching
$ curl -H "If-None-Match: Tue, 10 Jan 2017 12:22:50 GMT" -i https://www.blogger.com/feeds/2297891732714248935/posts/default
HTTP/1.1 200 OK
...
Expires: Tue, 10 Jan 2017 12:30:24 GMT
Date: Tue, 10 Jan 2017 12:30:24 GMT
Cache-Control: private, max-age=0
Last-Modified: Tue, 10 Jan 2017 12:22:50 GMT
...
@ScalaWilliam
ScalaWilliam / actionfps-headings.tsv
Created June 26, 2017 00:33
Old historical stuff
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
2015-12-01 Please consider spending 5 minutes every day in our <a href="https://groups.google.com/forum/#!forum/actionfps">new Community Forum</a>. Your participation, activity and feedback is always welcome.
2016-01-01
2016-01-03 http://actionfps.tumblr.com/post/134415507169/a-test
2016-03-30 Now we list <a href="https://actionfps.com/playerranks/">all players in the player ranks</a> regardless of their rank.
2016-04-01 Added the <a href="/hof/">Hall of Fame</a>! Should we have a prize for the first Cube Addict?<br/> Tell us <a href="https://gitter.im/ScalaWilliam/ActionFPS">on the ActionFPS Gitter chatroom</a>.
2016-04-10 "Added a new server <a href=""assaultcube://califa.actionfps.com:1999"">Califa.ActionFPS.Com:1999</a> (Los Angeles, USA)<br/>Added a new server <a
href=""assaultcube://bonza.actionfps.com:1999"">Bonza.ActionFPS.Com:1999</a> (Sydney, Australia)<br/>Added a new server <a
href=""assaultcube://legal.actionfps.com:1999"">Legal.ActionFPS.Com:1999</a> (São Paulo, Brazil)"
2016-04-22 Added the
@ScalaWilliam
ScalaWilliam / watch-specific-file.sh
Created June 26, 2017 00:31
Watching for changes for a specific file in Linux
inotifywait -m -e close_write,moved_to,create . |
while read -r directory events filename; do
if [ "$events" = "CLOSE_WRITE,CLOSE" ]; then
if [ "$filename" = "users.db.txt" ]; then
echo "K"
fi
fi
done