Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Harrrington prio

  • @mercyuniversityhosptial
  • Ireland
View GitHub Profile
@prio
prio / index.ts
Created May 5, 2021
An example of a left side panel extension for Jupyterlab.
View index.ts
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
ILabShell
} from '@jupyterlab/application';
import { Widget } from '@lumino/widgets';
/**
* Initialization data for the jupyterlab-sidepanel extension.
View czmq_const.erl
-module(czmq_const).
-compile(export_all).
-include_lib("czmq/include/czmq.hrl").
zmq_pair() ->
?ZMQ_PAIR.
zmq_pub() ->
?ZMQ_PUB.
@prio
prio / Scheduler.ex
Last active Aug 29, 2015
get_best_pid
View Scheduler.ex
defmodule Scheduler do
def get_best_pid(group) do
mems = :pg2.get_members(group) |>
Enum.map(fn(pid) ->
[message_queue_len: msgs, stack_size: ss] = :rpc.pinfo(pid, [:message_queue_len, :stack_size])
{pid, msgs, ss}
end) |>
Enum.sort(fn ({_, q1, s1}, {_, q2, s2}) -> q1 < q2 or (q1 == q2 and s1 < s2) end)
case mems do
[{pid, _, _} | _] -> pid
@prio
prio / gist:314831f9794f351b0ba2
Created Mar 26, 2015
Clojure Verticle Error
View gist:314831f9794f351b0ba2
Unexpected exception in Clojure verticle
java.lang.RuntimeException: No such var: eb/on-message, compiling:(clojure/YYYY/XXXX.clj:62:1)
at clojure.lang.Compiler.analyze(Compiler.java:6464)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3665)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6646)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5217)
@prio
prio / insert_data.sql
Last active May 17, 2016
Film Data File For Blog
View insert_data.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
@prio
prio / package.mk.diff
Created Apr 23, 2014
Add UPSTREAM_TAG to elixir_wrapper make file
View package.mk.diff
--- a/package.mk
+++ b/package.mk
@@ -3,6 +3,7 @@ DO_NOT_GENERATE_APP_FILE:=true
UPSTREAM_GIT:=git://github.com/elixir-lang/elixir.git
UPSTREAM_REVISION:=master
+UPSTREAM_TAG:=v0.12.0
RETAIN_ORIGINAL_VERSION:=true
ORIGINAL_APP_FILE=$(CLONE_DIR)/src/$(APP_NAME).app.src
@prio
prio / do-package.mk.diff
Created Apr 23, 2014
Add UPSTREAM_TAG support to rabbitmq-public-umbrella
View do-package.mk.diff
--- a/do-package.mk Tue Apr 15 13:11:24 2014 +0100
+++ b/do-package.mk Wed Apr 23 09:12:18 2014 +0100
@@ -233,6 +233,7 @@
# Work around weird github breakage (bug 25264)
cd $(CLONE_DIR) && git pull
$(if $(UPSTREAM_REVISION),cd $(CLONE_DIR) && git checkout $(UPSTREAM_REVISION))
+ $(if $(UPSTREAM_TAG),cd $(CLONE_DIR) && git checkout tags/$(UPSTREAM_TAG))
$(if $(WRAPPER_PATCHES),$(foreach F,$(WRAPPER_PATCHES),patch -d $(CLONE_DIR) -p1 <$(PACKAGE_DIR)/$(F) &&) :)
touch $$@
endif # UPSTREAM_GIT
@prio
prio / server.ex
Created Jan 6, 2014
Elixir gen_server example
View server.ex
defmodule Tcprpc.Server do
use GenServer.Behaviour
defrecord State, port: nil, lsock: nil, request_count: 0
def start_link(port) do
:gen_server.start_link({ :local, :tcprcp }, __MODULE__, port, [])
end
def start_link() do
@prio
prio / core.cljs
Last active Dec 28, 2015
Port of flpjax example to core.async
View core.cljs
(ns calc.core
(:require [dommy.core :as dom]
[cljs.core.async :refer [>! <! chan put!]])
(:require-macros [cljs.core.async.macros :refer [alt! go-loop]])
(:use-macros [dommy.macros :only [sel sel1]]))
(defn setup [id]
(let [el (sel1 id)
out (chan)
View notepad-with-dommy.cljs
(ns notepad.core
(:require [dommy.utils :as utils]
[dommy.core :as dommy])
(:use-macros [dommy.macros :only [node deftemplate]])
(:import [goog.ui Zippy]))
(defn create-note [item el]
(let [data (js->clj item)]
{:title (data "title") :content (data "content") :parent el}))