Skip to content

Instantly share code, notes, and snippets.

View msimav's full-sized avatar

Mustafa Simav msimav

View GitHub Profile
@msimav
msimav / build.sc
Created January 4, 2021 14:14
Generate dash docset for jq
import $ivy.`org.jsoup:jsoup:1.13.1`
import $ivy.`org.xerial:sqlite-jdbc:3.34.0`
import java.sql._
import org.jsoup.Jsoup
import ammonite.ops._
import scala.util.Using
import scala.collection.JavaConverters._
@msimav
msimav / antlr4-tester.sh
Last active September 27, 2018 13:31
A Bash script for quick-and-dirty testing of ANTLR 4 grammars
#/usr/bin/env bash
mandatory_binaries=( "java" "javac" )
for mandatory_binary in "${mandatory_binaries[@]}"
do
if ! type "$mandatory_binary" > /dev/null; then
echo "Please install $mandatory_binary"
exit
fi

Keybase proof

I hereby claim:

  • I am msimav on github.
  • I am msimav (https://keybase.io/msimav) on keybase.
  • I have a public key whose fingerprint is D695 1150 BEF6 FE60 9B4B CFDA 8402 B7F8 0816 DD31

To claim this, I am signing this object:

@msimav
msimav / Safely.scala
Last active July 29, 2016 11:05
Simple helper to run code in try catch and wrap it with Either
@inline def Safely[T](block: => T): Either[Exception, T] =
try {
Right(block)
} catch {
case e: Exception => Left(e)
}
object Example {
val result = Safely {
import language.experimental.macros
import reflect.macros.blackbox.Context
object MacroExample {
def debug(param: Any): String = macro debug_impl
def debug_impl(c: Context)(param: c.Expr[Any]): c.Expr[String] = {
import c.universe._
val paramRep = show(param.tree)