Skip to content

Instantly share code, notes, and snippets.

View codepitbull's full-sized avatar

Jochen Mader codepitbull

View GitHub Profile
@codepitbull
codepitbull / Dockerfile
Last active September 4, 2021 22:50
Run Gofer in Docker
# syntax=docker/dockerfile:1
FROM ubuntu:20.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gcc build-essential bison flex git emacs
RUN git clone https://github.com/rusimody/gofer.git /gofer && cd /gofer/src && make
FROM ubuntu:20.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y vim git emacs
COPY --from=0 /gofer/src/gofer /gofer
COPY --from=0 /gofer/*.pre /
ENV PUGOFER=/pusimple.pre
@codepitbull
codepitbull / scary.wat
Created April 17, 2020 06:28
Textual WASM
block ;; label = @8
local.get 1
i32.load offset=608
local.tee 3
i32.eqz
br_if 0 (;@8;)
local.get 1
i32.const 612
i32.add
i32.load
@codepitbull
codepitbull / server.scala
Created April 16, 2020 21:23
Vert.x Scala websocket server
val serverFuture = vertx
.createHttpServer()
.requestHandler(router)
.webSocketHandler(ctx => {
var ct = 0;
val r = scala.util.Random
val periodicId = vertx.setPeriodic(100, _ => {
ctx.writeTextMessage(JsonObject()
.put("time", ct.toFloat)
@codepitbull
codepitbull / static.scala
Created April 16, 2020 21:21
Vert.x Scala static file server
router
.route("/static/*")
.handler(StaticHandler.create().setCachingEnabled(false))
@codepitbull
codepitbull / websocket.rs
Created April 16, 2020 21:20
Rust WASM stdweb Websockets
extern crate stdweb;
use stdweb::web::{WebSocket, event::SocketMessageEvent, event::IMessageEvent, IEventTarget};
pub struct Mailbox {
socket : WebSocket,
received_messages : Rc<RefCell<Vec<String>>>,
}
impl Mailbox {
@codepitbull
codepitbull / log.rs
Created April 16, 2020 21:20
Rust WASM logging
console_log!("Connecting to {} and rendering results in plot", ws_url);
@codepitbull
codepitbull / logging.rs
Created April 16, 2020 21:19
Rust WASM console logging
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
// The `console.log` is quite polymorphic, so we can bind it with multiple
// signatures. Note that we need to use `js_name` to ensure we always call
// `log` in JS.
@codepitbull
codepitbull / panic.rs
Created April 16, 2020 21:17
Panic hook for Rust WASM
panic::set_hook(Box::new(console_error_panic_hook::hook));
@codepitbull
codepitbull / gist:44f20cc18904d30b1ba82c9ee28f44c9
Created June 12, 2017 18:38
Error while running org.jooq.util.GenerationTool against cockroachDB
[main] INFO org.jooq.util.AbstractDatabase - ARRAYs fetched : 0 (0 included, 0 excluded)
[main] WARN org.jooq.util.AbstractDatabase - SQL exception : Exception while executing meta query: ERROR: unsupported comparison operator: <oid> IN <tuple{oid}>
Please report this bug here: https://github.com/jOOQ/jOOQ/issues/new
select
"pg_catalog"."pg_namespace"."nspname",
"pg_catalog"."pg_type"."typname"
from "pg_catalog"."pg_type"
join "pg_catalog"."pg_namespace"
@codepitbull
codepitbull / cluster.xml
Created February 20, 2017 20:17
Broken cluster.xml
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.7.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<properties>
<property name="hazelcast.discovery.enabled">true</property>
</properties>
<network>
<join>
<multicast enabled="false"/>