Skip to content

Instantly share code, notes, and snippets.

View densh's full-sized avatar

Denys Shabalin densh

  • Zurich, Switzerland
View GitHub Profile
@densh
densh / keybase.md
Created January 26, 2016 10:08
Keybase proof

Keybase proof

I hereby claim:

  • I am densh on github.
  • I am den_sh (https://keybase.io/den_sh) on keybase.
  • I have a public key whose fingerprint is A7EB 371C E36F C968 528A 912E 4464 3DC9 4CC7 8F40

To claim this, I am signing this object:

@densh
densh / scoped-implicit-lifetimes.md
Last active October 18, 2020 17:02
Scoped Implicit Lifetimes

Scoped Implicit Lifetimes

All things considered, our experience in Scala Native has shown that resource management in Scala is way harder than it should be. This gist presents a simple design pattern that makes it resource management absolutely hassle-free: scoped implicit lifetimes.

The main idea behind it is to encode resource lifetimes through a concept of an implicit scope. Scopes are necessary to acquire resources. They are responsible for disposal of the resources once the evaluation exits the

@densh
densh / Snake.scala
Last active December 19, 2021 05:05
Snake game in 200 lines of Scala Native and SDL2 as demoed during Scala Matsuri 2017
import scalanative.native._
import SDL._
import SDLExtra._
@extern
@link("SDL2")
object SDL {
type Window = CStruct0
type Renderer = CStruct0
import scalanative.native._
import SDL._
import SDLExtra._
@extern
@link("SDL2")
object SDL {
type Window = CStruct0
type Renderer = CStruct0
# ab -n 10000 "http://127.0.0.1:7000/"
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@densh
densh / hello-cpp.txt
Created October 3, 2018 15:32
Hello World size of SN vs statically linked C++
# cat main.cpp
#include <stdio.h>
int main() {
printf("hello, world!");
return 0;
}
# clang++ -c -Os main.cpp
@densh
densh / spec-sharing.txt
Created October 24, 2018 14:44
Spec Sharing
# cat src/main/scala/Hello.scala
object Foo {
val a: Int = a
val b: Boolean = b
val c: Char = c
val d: String = d
}
object Test extends App {
println(Foo.a)