Skip to content

Instantly share code, notes, and snippets.

View sleepiecappy's full-sized avatar

Evangelista sleepiecappy

View GitHub Profile
import akka.actor.ActorRef;
import akka.dispatch.*;
import org.jctools.queues.MpscArrayQueue;
/**
* Non-blocking, multiple producer, single consumer high performance bounded message queue,
* this implementation is similar but simpler than LMAX disruptor.
*/
public final class MpscBoundedMailbox implements MessageQueue {
@sleepiecappy
sleepiecappy / app.scala
Created October 24, 2018 20:53
consume and reply to twitch ping message
package trolltracer
import akka.actor.ActorSystem
import akka.http.scaladsl.model.ws._
import akka.http.scaladsl.Http
import akka.stream.{ActorMaterializer, BidiShape}
import akka.stream.scaladsl.{
Flow,
GraphDSL,
Keep,
Merge,
@sleepiecappy
sleepiecappy / observer.md
Created October 24, 2018 03:18 — forked from pnc/observer.md
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@sleepiecappy
sleepiecappy / chat.ex
Created October 22, 2018 18:31
not working chat, idk for future reference
defmodule Engag.ChatFeed do
alias :gun, as: Gun
@type message :: {:text, iodata()}
@type channel :: String.t()
def connect(nickname, token) do
with {:ok, conn} <- http(),
{:ok, _protocol} <- Gun.await_up(conn),
_ref <- upgrade(conn),
@sleepiecappy
sleepiecappy / .editorconfig
Last active October 18, 2018 16:33
scala project common files
# http://editorconfig.org/
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
max_line_length = 80
using local
# input ... converter ... list of files ....
given fasta_files('influenza.fasta', 'influenza_2.fasta') do
# ... ops ....
align by pair
# .... execute file passing context ....
exec './myscript.py'
# ..... generate a report or plot
report
end
@sleepiecappy
sleepiecappy / build.gradle.kts
Last active September 19, 2018 17:32
Gradle Kotlin DSL for ktor
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "com.github.sleepiejohn"
version = "1.0-SNAPSHOT"
plugins {
kotlin("jvm") version "1.3-M2"
application
}
@sleepiecappy
sleepiecappy / elixir.json
Last active August 24, 2018 04:25
VSCode Elixir Snippets
{
"Module definition": {
"prefix": "mod",
"body": [
"defmodule $1 do",
" $0",
"end"
]
},
"Function definition": {
@sleepiecappy
sleepiecappy / .formatter.exs
Created June 11, 2018 05:22
Elixir formatter for Phoenix without parentheses
[
  inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"],
  locals_without_parens: [
# Kernel
    inspect: 1,
Inspiration
Pipelines with Kotlin: https://bit.ly/2Lb1dBu