Skip to content

Instantly share code, notes, and snippets.

@fdlk
fdlk / ping.py
Last active February 9, 2021 13:33
Ping script for FAIR datapoint home
import urllib.request
import json
body = json.dumps({'clientUrl': 'http://localhost/api/fdp'}).encode('utf-8')
req = urllib.request.Request('https://home.fairdatapoint.org')
req.add_header('Content-Type', 'application/json; charset=utf-8')
response = urllib.request.urlopen(req, body)
library(remotes)
install_github("molgenis/molgenis-r-datashield")
install_github("datashield/dsBaseClient@v6.0-dev")
install_github("datashield/DSI")
install_github("obiba/opalr")
install_github("datashield/DSOpal")
library(DSI)
library(DSOpal)
library(dsBaseClient)
server <- c("opal-dsi")
.get_info <- function(armadillo_server) {
info_url <- armadillo_server
urltools::path(info_url) <- "actuator/info"
response <- httr::GET(info_url)
httr::stop_for_status(response, task="fetch server info")
return(httr::content(response))
}
.discover_endpoint <- function(auth_server) {
openid_config_url <- auth_server
@fdlk
fdlk / push.py
Last active November 5, 2019 20:55
scrape hashicorp kv store contents
import json
import subprocess
# read file
with open('scraped.json', 'r') as scraped:
data=scraped.read()
# parse file
obj = json.loads(data)
@fdlk
fdlk / run-ibd-script.md
Last active August 31, 2017 11:27
R plot on homepage
  1. install python package manager pip in local user dir
> curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py”
> python get-pip.py --user
> rm get-pip.py
  1. install requests module in user dir
@fdlk
fdlk / .block
Last active July 8, 2017 21:26 — forked from mbostock/.block
Zoomable Circle Packing
license: gpl-3.0
height: 960
@fdlk
fdlk / sonarqube-slack-notify.js
Last active June 4, 2018 16:21
A hook.io microservice that transforms a sonarqube webhook into a slack notification webhook
var slack = require('slack-notify')
var moment = require('moment-timezone')
function formatFloat(value) {
return (value && !isNaN(value)) ? parseFloat(value).toFixed(1) : value
}
function formatValue(value) {
if(typeof value == 'number') {
return value.toFixed(1)
@fdlk
fdlk / rsql.pegjs
Created January 4, 2017 23:58
rsql grammar for pegjs
/*
* RSQL parser
*/
or = head:and tail:("," and)* {
if(tail.length == 0) return head;
var result = [head], i;
for (i = 0; i < tail.length; i++) {
result.push(tail[i][1]);
}
@fdlk
fdlk / pulls.py
Last active March 16, 2017 15:15
Fetch pull requests through github API
from __future__ import unicode_literals
import requests
import json
import argparse
parser = argparse.ArgumentParser(description="""Retrieves pull request numbers and titles from the GitHub REST API.
Only merged pull requests will be listed.""")
parser.add_argument('-t', '--token', required=True,
help="""Generate an OAUTH token on your GitHub personal settings page, under Personal access tokens,
and provide it as an argument here. You need not give it any scopes.""")
@fdlk
fdlk / dicom-tables.xslt
Last active August 29, 2015 14:08
Parse DICOM tags table
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="text" encoding="UTF-8" indent="no" />
<xsl:strip-space elements="*"/>
<xsl:template match="/">