Skip to content

Instantly share code, notes, and snippets.

View danyill's full-sized avatar
🔭

danyill

🔭
  • 10:10 (UTC +12:00)
View GitHub Profile
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.6">
<meta name="author" content="Transpower New Zealand Ltd">
<title>Test Package</title>
<style>
@danyill
danyill / attributes-include.adoc
Created August 29, 2018 09:53
Default header include
:figure-caption: Figure
:toc: left
:docinfo: shared
:docinfodir: {assetdir}
:docinfosubs: attributes
:safe-mode-unsafe:
:iconfont-remote!:
:stylesheet: asciidoctor.css
:scriptsdir: {assetdir}
:linkcss!:
@danyill
danyill / gist:49b9dc4d0ae0b0fcf1d15df513550270
Created October 28, 2018 03:38 — forked from zacharyvoase/gist:1770447
zmqc: A small but powerful command-line interface to ZMQ.
#!/usr/bin/env python
# zmqc: a small but powerful command-line interface to ZMQ.
## Usage:
# zmqc [-0] (-r | -w) (-b | -c) SOCK_TYPE [-o SOCK_OPT=VALUE...] address [address ...]
## Examples:
# zmqc -rc SUB 'tcp://127.0.0.1:5000'
#
# Subscribe to 'tcp://127.0.0.1:5000', reading messages from it and printing
@danyill
danyill / parsoid1.txt
Created November 20, 2018 19:17
Parsoid errors
</section><section data-mw-section-id="24" data-parsoid="{}"><h3 id="Step_2b:_Create_a_new_page" data-parsoid='{"dsr":[7060,7094,3,3]}'> Step 2b: Create a new page </h3>
<p data-parsoid='{"dsr":[7096,7129,0,0]}'><figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"1200px"}],"dsr":[7096,7129,null,null]}' data-mw='{"errors":[{"key":"apierror-unknownerror","message":{}}]}'><a href="./File:Script_step2b.png" data-parsoid='{"a":{"href":"./File:Script_step2b.png"},"sa":{"href":"File:script_step2b.png"}}'><img resource="./File:Script_step2b.png" src="./Special:FilePath/Script_step2b.png" height="1200" width="1200" data-parsoid='{"a":{"resource":"./File:Script_step2b.png","height":"1200","width":"1200"},"sa":{"resource":"File:script_step2b.png"}}'/></a></figure-inline></p>
</section><section data-mw-section-id="25" data-parsoid="{}"><h3 id="Step_2c:_create_the_model" data-parsoid='{"dsr":[7131,7164,3,3]}'> Step 2c: create the model </h3>
<p data-parsoid='{"dsr":[7166,7248,0,0]}'>
@danyill
danyill / parsoid2.txt
Created November 20, 2018 19:28
diagnosing1
echo '[[File:script_step2b.png|1200px]]' | bin/parse.js --trace apirequest
in/parse.js --trace apirequestsoid# echo '[[File:script_step2b.png|1200px]]' | bi
[ApiRequest] | #1 Starting HTTP request: {"method":"GET","followRedirect":true,"uri":"https://en.wikipedia.org/w/api.php","qs":{"format":"json","action":"query","meta":"siteinfo","siprop":"namespaces|namespacealiases|magicwords|functionhooks|extensiontags|general|interwikimap|languages|languagevariants|protocols|specialpagealiases|defaultoptions|variables","rawcontinue":1},"timeout":40000,"agent":{"_events":{},"_eventsCount":1,"defaultPort":443,"protocol":"https:","options":{"maxSockets":15,"connectTimeout":5000,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keepAliveMsecs":1000,"keepAlive":false,"maxSockets":15,"maxFreeSockets":256,"maxCachedSessions":100,"_sessionCache":{"map":{},"list":[]}},"headers":{"X-Request-ID":null,"User-Agent":"Parsoid/0.9.0","Connection":"close"},"strictSSL":true}
[ApiRequest] | #1 Received HTTP 200, 134743 by
@danyill
danyill / parsoid3
Created November 20, 2018 19:43
response when using my config.yaml
root@9f85ddc6532d:/var/lib/parsoid# echo '[[File:script_step2b.png|1200px]]' | bin/parse.js --config ./config.yaml --trace apirequest
/var/lib/parsoid/node_modules/prfun/lib/index.js:424
setTimeout(function() { throw e; }, 0);
^
Error: No API URI available for prefix: null; domain: en.wikipedia.org
at Function.<anonymous> (/var/lib/parsoid/lib/config/MWParserEnvironment.js:489:9)
at Generator.next (<anonymous>)
at tryCatchNext (/var/lib/parsoid/node_modules/prfun/lib/index.js:783:28)
at continuer (/var/lib/parsoid/node_modules/prfun/lib/index.js:800:24)
@danyill
danyill / config.yaml
Created November 20, 2018 20:04
parsoid configuration
root@9f85ddc6532d:/var/lib/parsoid# cat config.yaml
# Number of worker processes to spawn.
# Set to 0 to run everything in a single process without clustering.
# Use 'ncpu' to run as many workers as there are CPU units
num_workers: 0
worker_heartbeat_timeout: 300000
logging:
level: info
@danyill
danyill / api_query.txt
Created November 20, 2018 20:07
api query
{
"batchcomplete": "",
"query": {
"normalized": [
{
"from": "File:Script_step2b.png",
"to": "File:Script step2b.png"
}
],
"pages": {
@danyill
danyill / parsoid_request_log.txt
Created November 20, 2018 20:09
parsoid request with correct domain
in/parse.js --config ./config.yaml --domain web --trace apirequest|1200px]]' | bi
[ApiRequest] | #1 Starting HTTP request: {"method":"GET","followRedirect":true,"uri":"http://web/w/api.php","qs":{"format":"json","action":"query","meta":"siteinfo","siprop":"namespaces|namespacealiases|magicwords|functionhooks|extensiontags|general|interwikimap|languages|languagevariants|protocols|specialpagealiases|defaultoptions|variables","rawcontinue":1},"timeout":40000,"agent":{"_events":{},"_eventsCount":1,"defaultPort":80,"protocol":"http:","options":{"maxSockets":15,"connectTimeout":5000,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keepAliveMsecs":1000,"keepAlive":false,"maxSockets":15,"maxFreeSockets":256},"headers":{"X-Request-ID":null,"User-Agent":"Parsoid/0.9.0","Connection":"close"},"strictSSL":true}
[ApiRequest] | #1 Received HTTP 200, 71547 bytes
Error in ParsoidLogger._defaultTracerBackend: TypeError: Converting circular structure to JSON
[ApiRequest] | #2 Received HTTP 200, 6896 bytes
[Api
@danyill
danyill / gist:13cee7020cf9eaab07140a0b12ec486d
Last active November 20, 2018 20:15
api query with width
https://kokako.cc/w/api.php?action=query&titles=File:Script_step2b.png&prop=imageinfo&iiprop=url&iiurlwidth=1200
{
"batchcomplete": "",
"query": {
"normalized": [
{
"from": "File:Script_step2b.png",
"to": "File:Script step2b.png"
}