Skip to content

Instantly share code, notes, and snippets.

View darkone23's full-sized avatar
💭
💾☠🕸

0/∞ darkone23

💭
💾☠🕸
View GitHub Profile
@darkone23
darkone23 / AvroHTTP.avdl
Last active August 21, 2023 08:29
Example generic spark setup that uses avro for schemas and the parquet file format for storage
@namespace("com.example.avro.parquet.spark")
protocol HTTP {
record Header {
string name;
string value;
}
record Request {
string method;
string path;

Keybase proof

I hereby claim:

  • I am darkone23 on github.
  • I am computerdream (https://keybase.io/computerdream) on keybase.
  • I have a public key ASByi280sM-nnhsDWYolY_IjV9V_EpQyGvajNhqm_o9D-Qo

To claim this, I am signing this object:

@darkone23
darkone23 / net.cljs
Last active May 11, 2021 12:12
websocket as a cljs core.async channel
(ns example.net
(:require [goog.net.WebSocket]
[goog.events :refer (listen)]
[cljs.core.async :as async :refer (chan <! >! put! close)]
[cljs.core.async.impl.protocols :as proto])
(:require-macros [cljs.core.async.macros :refer (go)]))
(defn ws
"WebSocket as a core.async channel
returns a channel which delivers the ws chan then closes"
@darkone23
darkone23 / err.java
Created April 24, 2015 22:03
kafka-oom
15/04/24 15:02:33 INFO consumer.SimpleConsumer: Reconnect due to socket error: java.lang.OutOfMemoryError: Java heap space [25/1940]15/04/24 15:02:36 ERROR network.BoundedByteBufferReceive: OOME with size 14680400
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57)
at java.nio.ByteBuffer.allocate(ByteBuffer.java:331)
at kafka.network.BoundedByteBufferReceive.byteBufferAllocate(BoundedByteBufferReceive.scala:80)
at kafka.network.BoundedByteBufferReceive.readFrom(BoundedByteBufferReceive.scala:63)
at kafka.network.Receive$class.readCompletely(Transmission.scala:56)
at kafka.network.BoundedByteBufferReceive.readCompletely(BoundedByteBufferReceive.scala:29)
at kafka.network.BlockingChannel.receive(BlockingChannel.scala:111)
at kafka.consumer.SimpleConsumer.liftedTree1$1(SimpleConsumer.scala:79)

Confusion around om functionality

(defn static-data []
  (for [row (range 10)]
    {:a "some" :b "fake" :c "data"}))

(def app-state (atom {:items (static-data)}))

;;; components
@darkone23
darkone23 / list.rs
Last active January 3, 2016 07:19
how do i link list
use std::fmt::Default;
enum List<T> {
Cons(T, ~List<T>),
Nil
}
fn cons<T>(x: T, xs: List<T>) -> List<T> {
Cons(x, ~xs)
}
fn gen_closure(x: int) -> proc(int) -> int {
return proc(y: int) { x * y };
}
fn main() {
println!("{}", gen_closure(2)(3))
}
// 6
@darkone23
darkone23 / async.clj
Last active December 28, 2015 04:49
huh?
; egghead@thoth: ~/projects/clojure/async
; ~> time lein run
; => lein run 7.29s user 0.60s system 114% cpu 6.888 total
; egghead@thoth: ~/projects/clojure/async
; ~> cat output.txt | wc -l
; => 97
; egghead@thoth: ~/projects/clojure/async
; ~> cat src/async/core.clj
(ns async.core
(:require [clojure.core.async :refer (chan go-loop <! >!!)])
input {
generator {}
}
filter {
metrics {
meter => "events"
add_tag => "metric"
}
}
function template(href, text) {
return ['<a href="', href, '" target="_blank">', text, "</a>"].join('');
}
Running "nodeunit:files" (nodeunit) task
Testing linkify_test.js.............................F...........
>> test.com/"/onmouseover="alert(document.cookie)
>> Error: false == true
>> at Object.tests.(anonymous function) (tests/linkify_test.js:85:10)