Skip to content

Instantly share code, notes, and snippets.

View rberenguel's full-sized avatar

Ruben Berenguel rberenguel

View GitHub Profile
package hello
import java.io.ByteArrayOutputStream
import chisel3._
import chisel3.iotesters.{Driver, PeekPokeTester}
sealed trait Op
object Op{
case class GotoIfZero(dest: Byte, valueAddr: Byte) extends Op
@kmader
kmader / README.md
Last active October 31, 2023 14:21
Beating Serialization in Spark

Serialization

As all objects must be Serializable to be used as part of RDD operations in Spark, it can be difficult to work with libraries which do not implement these featuers.

Java Solutions

Simple Classes

For simple classes, it is easiest to make a wrapper interface that extends Serializable. This means that even though UnserializableObject cannot be serialized we can pass in the following object without any issue

public interface UnserializableWrapper extends Serializable {
 public UnserializableObject create(String parm1, String parm2);
@rberenguel
rberenguel / PoorMan$.js
Last active December 25, 2015 17:29
A very poor man's HTML element selector. As much as I tried I couldn't fit it in a tweet, though. The best I could minify it has been to 154 bytes (as $$ below, it would be cool if it could be called ¢...)
function $(s){
z="getElement";n="Name";
a={"#" : z+"ById",
"." : z+"sByClass"+n,
}[s[0]];
a=typeof a==="undefined"?[z+"sByTag"+n,0]:[a,1];
return document[a[0]](s.slice(a[1]));
}
function $$(s){return S="slice",d=document,t=s[0],g="getElement",n="Name",t=="#"?d[g+"ById"](s[S](1)):t=="."?d[g+"sByClass"+n](s[S](1)):d[g+"sByTag"+n](s)}