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 June 25, 2018 15:00
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 "https://gist.github.com/mfikes/e00202b2de7cc2352fedcf92b1fe60dc" :sha "68ef581813e08a92bd52e7beeea1535ab7b3337f"}}}' -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.

clj -Sdeps '{:deps {github-mfikes/chambered {:git/url "https://github.com/mfikes/chambered" :sha "50265ab42f149450f15375117dcdf5d83c5efcf3"}}}' -m cljs.main -c chambered.core -r

After the REPL starts, if it doesn't automatically, open your browser to

http://localhost:9000

The source for this project is at https://github.com/mfikes/chambered

@jmlsf
jmlsf / js-in-cljs.md
Last active January 25, 2024 23:15
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

@schweigert
schweigert / Embedding GoLang into a Ruby application.md
Last active March 17, 2024 01:46
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

@nasser
nasser / BoidBehaviour.cs
Last active July 22, 2022 01:51
Source code to the MAGIC boids iOS demo (http://nas.sr/magic/2017/12/28/early-ios.html)
using UnityEngine;
public class BoidBehaviour : MonoBehaviour
{
void Update()
{
Boids.Core.update(transform);
}
}

How Clojure's documentation can leapfrog other languages

Summary

I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.

The Problem

Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."

How To Clone Scrypt Based Altcoins for Fun and Profit

Wait a second, why would you want to give out the secrets?!? Because its not a secret anymore and besides, why shouldn't everyone and their neighbors be able to create a plethora of these useless yet exciting math bits? The information in this article took me a few weeks to compile and what works for me is not guaranteed to work for you. Please use this guide as a starting point to learn a bit about C programming and compiling software.

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

http://abclive.abcnews.com/i/abc_live4@136330/master.m3u8
http://mumsite.cdnsrv.jio.com/jiotv.live.cdn.jio.com/Mastiii/Mastiii_800.m3u8
http://jiotv.live.cdn.jio.com/Sony_BBC_Earth_HD/Sony_BBC_Earth_HD_TAB.m3u8
http://hotstar.live.cdn.jio.com/Star_Plus_HD/Star_Plus_HD.m3u8
http://hotstar.live.cdn.jio.com/Life_OK_HD/Life_OK_HD.m3u8
http://jiotv.live.cdn.jio.com/Zindagi/Zindagi_TAB.m3u8
http://hotstar.live.cdn.jio.com/Channel_V/Channel_V.m3u8
http://jiotv.live.cdn.jio.com/DD_National/DD_National_TAB.m3u8
http://mumsite.cdnsrv.jio.com/jiotv.live.cdn.jio.com/Neo_Prime/Neo_Prime_800.m3u8
http://smumcdnems03.cdnsrv.jio.com/jiotv.live.cdn.jio.com/Star_Sports_HD_1/Star_Sports_HD_1.m3u8
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!