Skip to content

Instantly share code, notes, and snippets.

Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
Block or report user

Report or block metacritical

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View clojure
#!/usr/bin/env bash
# Version =
set -e
function join { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
# Extract opts
metacritical /
Created Dec 8, 2018 — forked from bhauman/
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

metacritical /
Created Dec 5, 2018 — forked from jmlsf/
Using JavaScript modules in ClojureScript

Using JavaScript Libraries from ClojureScript

Using JavaScript libraries from ClojureScript involves two distinct concerns:

  1. Packaging the code and delivering it to the browser
  2. Making ClojureScript code that accesses JavaScript libraries safe for advanced optimization

Right now, the only single tool that solves these probems reliably, optimally, and with minimal configuration is shadow-cljs, and so that is what I favor. In paricular, shadow-cljs lets you install npm modules using npm or yarn and uses the resulting package.json to bundle external dependencies. Below I describe why, what alternatives there are, and what solutions I disfavor at this time.

Packaging and Delivering Code

metacritical / jit.cpp
Created Sep 19, 2018 — forked from tomas789/jit.cpp
LLVM JIT Example - Example of very simple JIT using LLVM. It compiles function with prototype `int64_t()` returning value `765`. Build: clang++ `llvm-config --cppflags --ldflags --libs core jit X86` jit.cpp
View jit.cpp
#include <iostream>
#include <cstdint>
#include <string>
#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Analysis/Verifier.h"
metacritical /
Last active Sep 6, 2018
Clang compilation commands.

CLang -> llvm

  • clang -S -emit-llvm program.c

llvm -> assembly

  • llc program.ll -o program.s

Evaluate llvm bit code

  • lli struct.ll

Make So files from C in clang

  • clang -O3 -dynamiclib -undefined dynamic_lookup runtime.c program.s -o
metacritical / gits.go
Created Jul 19, 2018
Git Prompt PS1 in go lang.
View gits.go
package main
import (
View core.clj
(ns dbooked-clj.core
(:import (java.time LocalDateTime format.DateTimeFormatter)))
(defn parse-datetime [date-str]
"Parse datetime."
(LocalDateTime/parse date-str (DateTimeFormatter/ISO_DATE_TIME)))
(defn is-before? [this that]
"Is this time before that?"
(.isBefore this that))
metacritical / fsm.clj
Created Apr 27, 2018 — forked from mnicky/fsm.clj
Finite State Machine in Clojure core.logic
View fsm.clj
(ns fsm
(:refer-clojure :exclude [==])
(:use [clojure.core.logic]))
;; Encoding a Finite State Machine and recognizing strings in its language in Clojure core.logic
;; We will encode the following FSM:
;; (ok) --+---b---> (fail)
;; ^ |
metacritical / 90-min-scc.scm
Created Apr 15, 2018 — forked from nyuichi/90-min-scc.scm
The 90 Minute Scheme to C Compiler
View 90-min-scc.scm
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved.
; This is the "90 minute Scheme to C compiler" presented at the
; Montreal Scheme/Lisp User Group on October 20, 2004.
; Usage with Gambit-C 4.0:
; % ./90-min-scc.scm test.scm
metacritical /
Created Mar 14, 2018 — forked from mfikes/
Bocko in browser using cljs.main and synthetic index.html

First start up the REPL by issuing this command:

clj -Sdeps '{:deps {github-mfikes/e00202b2de7cc2352fedcf92b1fe60dc {:git/url "" :sha "c18479fa4fdf4bb2af3d971cb1aaeb2cbd8c909c"}}}' -m cljs.main -i @index.cljs -r

Once the REPL is waiting for the browser to connect, if it doesn't automatically, open http://localhost:9000 in your browser.

You will now be running Bocko. The following forms evaluated in the REPL will draw an American flag.

You can’t perform that action at this time.