Skip to content

Instantly share code, notes, and snippets.

View d00rman's full-sized avatar

Marko Obrovac d00rman

  • Rovinj, Croatia
View GitHub Profile
@d00rman
d00rman / move-math.js
Created December 21, 2017 16:34
Move Math data script
#!/usr/bin/env nodejs
'use strict';
const cassandra = require('cassandra-driver');
const P = require('bluebird');
const preq = require('preq');
const yargs = require('yargs');
'use strict';
const preq = require('preq');
return preq.post({
uri: 'https://en.wikipedia.org/w/api.php',
headers: {
'content-type': 'application/json'
},
body: {
@d00rman
d00rman / gist:fb04e99c7f80494acf39ee20d596cfcb
Created November 1, 2017 12:31
Conftool run from restbase2012
# curl http://208.80.154.57:9090/pools/restbase_7231 | sort
restbase1007.eqiad.wmnet: enabled/up/pooled
restbase1011.eqiad.wmnet: enabled/up/pooled
restbase1012.eqiad.wmnet: enabled/up/pooled
restbase1013.eqiad.wmnet: enabled/up/pooled
restbase1014.eqiad.wmnet: enabled/up/pooled
restbase1015.eqiad.wmnet: enabled/up/pooled
restbase1016.eqiad.wmnet: enabled/up/pooled
restbase1017.eqiad.wmnet: enabled/up/pooled
restbase1018.eqiad.wmnet: enabled/up/pooled
"use strict";
const crypto = require('crypto');
const align = require('string-align');
const cassandra = require('cassandra-driver');
const colors = require('colors/safe');
const fs = require('fs');
const yaml = require('js-yaml');
const P = require('bluebird');
@d00rman
d00rman / Dockerfile
Created July 12, 2016 16:20
Parsoid Dockerfile
FROM debian:jessie
RUN apt-get update && apt-get install -y nodejs nodejs-legacy npm git wget && rm -rf /var/lib/apt/lists/*
ENV NVM_DIR /usr/local/nvm
RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash && . $NVM_DIR/nvm.sh && nvm install 4.4.6
RUN groupadd -g 1000 -r rungroup && useradd -m -r -g rungroup -u 1000 runuser
USER runuser
ENV HOME=/home/runuser LINK=g++
ENV IN_DOCKER=1
CMD . $NVM_DIR/nvm.sh && nvm use 4.4.6 && npm install --production && npm install heapdump && npm dedupe
#!/bin/bash
declare PUPPET_PATH='<path_to_ops_puppet_repo_locally>';
declare JENKINS_TOKEN='<your_token_from_integration.wikimedia.org>';
declare JENKINS_USERNAME='<your-username>';
declare change_id="${1}";
declare hosts="${2}";
@d00rman
d00rman / schema.yaml
Created April 28, 2016 18:39
Error object schema idea
event:
type: object
properties:
structured_field1:
type: type1
structured_field2:
type: type2
structured_field3:
type: type3
stringified_event:
@d00rman
d00rman / change-prop.yaml
Last active November 11, 2015 15:23
Change Propagation Config
---
# rule name
refresh-html:
# the topic to watch for
topic: mw-page-edit
# the modules to call when a message arrives there
exec:
# call the request module and pass in the params it expects
- request:
uri: http://restbase.svc.eqiad.wmnet:7231/{$.message.event.domain}/v1/page/html/{$.message.title}/{$.message.revision}
@d00rman
d00rman / a.json
Last active October 8, 2015 11:03
POST data security bug reproduction code
http://localhost:7231
POST /en.wikipedia.org/v1/media/math/svg
{
"q": "c^2=a^2+b^2",
"type": "tex"
}
http://localhost:7231
GET /wikimedia.org/v1/media/math/png/049ce72abeb43eeca53d3e55a1d226bffc0cb0f1
@d00rman
d00rman / rb-config.yaml
Created October 8, 2015 11:01
POST data checks - config.yaml
# RESTBase config
info:
name: restbase
templates:
wmf-content-1.0.0: &wp/content/1.0.0
swagger: '2.0'