Skip to content

Instantly share code, notes, and snippets.

View MonadicT's full-sized avatar

Praki Prakash MonadicT

  • San Francisco Bay Area
View GitHub Profile
(defmacro delegate-protcols
"delegate protcol(s) to a member"
[from to & protocols]
`(extend
~from
~@(reduce #(concat %1 (cons (first %2) (rest %2)))
nil
(map (fn [p]
`(~p ~(into
{}
mp_bin="mpost -TEX=latex"prolog = "verbatimtex\n\
\\\documentclass{article}\n\
\\\begin{document}\n\
\etex\n\n\
\input boxes\n\
\input FuncMP\n\n"
epilog = "\n\n\\end"
defaultDX = 3
/**
* Code to illustrate garbage collector's handling of SoftReference objects.
*
* A number of soft references to byte arrays are added to a hash
* map. For some of those byte arrays, strong references are also
* retained. When garbage collector runs out of memory, it should
* clear all soft references except the ones to which we have strong
* references.
*/
/**
* Code to illustrate garbage collector's handling of WeakReference objects.
*
* A number of weak references to byte arrays are added to a hash
* map. For some of those byte arrays, strong references are also
* retained. When garbage collector runs out of memory, it should
* clear all soft references except the ones to which we have strong
* references.
*/
/* Illustration of phantom references handling */
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
/**
* An object which requires cleanup action when reclaimed
*/
class MyObject {
;; Copyright (C) 2014 by Praki Prakash
(ns monadict.throttle
(require
[clojure.core.async :as async]))
(defmacro defn-throttled
"Defines a function which will only be invoked after a specified
interval (ms). Syntax is the same as defn but precede the argument
vector with interval specified in milliseconds.
@MonadicT
MonadicT / dot-emacs.org
Created April 16, 2014 15:29
What is this?

Emacs customization

Debug on error

(setq debug-on-error t)

Turn off splash screen

(setq inhibit-startup-message t)        ; no splash screen
@MonadicT
MonadicT / foo.tex
Created May 19, 2018 21:03
tex - Tikz block diagram
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, positioning, backgrounds, fit}
\begin{document}
\tikzset{
sys/.style = {draw, rectangle, rounded corners=5,
node distance = 2cm, minimum height=2cm, minimum width=4cm},
}
@MonadicT
MonadicT / minimal.tex
Created May 19, 2018 21:08
tex - Minimal Tikz document
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, positioning, backgrounds, fit}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (10, 10);
\end{tikzpicture}
\end{document}
@MonadicT
MonadicT / minimal.tex
Created May 19, 2018 23:44
tex - Tikz box alignment
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, positioning, backgrounds, fit}
\begin{document}
\begin{tikzpicture}[node distance=1 and 1]
\draw[help lines, very thin] (-1,-3) grid (5, 1);
% Drawing boxes left aligned
\node at (0,0) [rectangle,white,fill=red] (D) {D};