Skip to content

Instantly share code, notes, and snippets.

View prio's full-sized avatar

Jonathan Harrrington prio

View GitHub Profile
HOST = ''
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': f'Bearer {get_token()}'
}
# Just runs Export atm
def main(command: str, directory: str):
"Runs outline export and either downloads the zip (default) or extracts it to dir"
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace PgWire;
class PgBuffer
{
// private NetworkStream _stream;
//
@prio
prio / index.ts
Created May 5, 2021 19:29
An example of a left side panel extension for Jupyterlab.
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
ILabShell
} from '@jupyterlab/application';
import { Widget } from '@lumino/widgets';
/**
* Initialization data for the jupyterlab-sidepanel extension.
-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 August 29, 2015 14:23
get_best_pid
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 March 26, 2015 14:08
Clojure Verticle Error
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 23:02
Film Data File For Blog
--
-- 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 April 23, 2014 08:14
Add UPSTREAM_TAG to elixir_wrapper make file
--- 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 April 23, 2014 08:12
Add UPSTREAM_TAG support to rabbitmq-public-umbrella
--- 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 January 6, 2014 22:16
Elixir gen_server example
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