Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@mfikes
mfikes / README.md
Last active March 8, 2019 12:11
cljs.main rebel-readline

Start cljs.main with rebel-readline:

clojure -Sdeps '{:deps {github-mfikes/cljs-main-rebel-readline {:git/url "https://gist.github.com/mfikes/9f13a8e3766d51dcacd352ad9e7b3d1f" :sha "27b82ef4b86a70afdc1a2eea3f53ed1562575519"}}}' -i @setup.clj -m cljs.main
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
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.

@mfikes
mfikes / README.md
Last active May 17, 2020 02:37
Seeing the inferred type of a ClojureScript expression

If you are curious about the types inferred by ClojureScript, it is easy to get some insight using a macro:

(defmacro inferred-type [form]
  `'~(cljs.analyzer/infer-tag &env
       (cljs.analyzer/no-warn (cljs.analyzer/analyze &env form))))

This is the kind of dev-time macro you could refer using the new user.cljs feature.

@metacritical
metacritical / headless-p5.md
Created August 15, 2021 12:07 — forked from dropmeaword/headless-p5.md
Headless processing

Running processing without a screen

Let's say you want to run a Processing sketch on a server. Like maybe you want to generate several million PDF and JPEG images using a handful of Amazon EC2 instances.

This is called “headless” mode, and to do so, it's necessary to install what's known as a virtual frame buffer.

On Ubuntu 14.04, these are the things you need to install first:

sudo apt-get install xvfb libxrender1 libxtst6 libxi6 
@Checksum
Checksum / diff-patch.jq
Last active August 26, 2021 01:04
JSON diff and patch for jq
# JSON diff and patch for jq (https://stedolan.github.io/jq/)
# Author: Srinath Sankar
#
# Usage:
# diff: jq -sS 'include "diff-patch"; diff' a.json b.json > patch.json
# patch: jq -sS 'include "diff-patch"; patch' a.json patch.json
#
# Caveats: tested only with top level objects using jq 1.6
def flatten_obj:
@tilarids
tilarids / tiny_hello.asm
Created September 23, 2016 00:49
A minimal Mach-o x32 executable for OS X El Capitan (with proper padding and symtable)
; A minimal Mach-o x32 executable for OS X El Capitan (with proper padding and symtable)
;
; Original (pre 10.10.5) version - https://gist.github.com/softboysxp/1084476
; $ nasm -O0 -f bin -o tiny_hello tiny_hello.asm
; $ chmod +x tiny_hello
; $ ./tiny_hello
; (returns 42)
; $
; c.f.
@gsluthra
gsluthra / tree_html5.html
Created August 20, 2012 07:10
Fractal Tree Generation using HTML5 Canvas and Random Numbers
<html>
<head>
<script type="text/javascript">
window.onload = draw;
function draw(){
@vkravets
vkravets / X11FullscreenHelper.java
Created April 12, 2013 08:49
Java Full Screen window on Linux OSs using native X11 calling
package org.linux.X11;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.platform.unix.X11;
import java.awt.*;
/**
* Author: Vladimir Kravets
@tomas789
tomas789 / jit.cpp
Created December 28, 2013 17:57
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
#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"