Skip to content

Instantly share code, notes, and snippets.

View PiotrZakrzewski's full-sized avatar

Piotr Zakrzewski PiotrZakrzewski

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PiotrZakrzewski
PiotrZakrzewski / list_fun_calls.py
Last active April 5, 2021 07:41
List function calls within a Python function declaration with the ast module.
"""List function calls within a Python function declaration with the ast module."""
import ast
class PrintCalls(ast.NodeVisitor):
def visit_Call(self, node):
print(node.func.id)
code = """def fun(a:int) -> int:
b = util_fun(a)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from github import Github
from time import time
from calendar import timegm
from statistics import median
import requests
import json
GITHUB_API_TOKEN = "REPLACE_ME"
WEBHOOK_URL = "REPLACE_ME"
TARGET_ORG = "REPLACE_ME"

Keybase proof

I hereby claim:

  • I am piotrzakrzewski on github.
  • I am piotrzakrzewski (https://keybase.io/piotrzakrzewski) on keybase.
  • I have a public key ASAu2338QxVxUiOEJ48YaZyaR2Ah2eaDKPBGnYfziMqxhAo

To claim this, I am signing this object:

@PiotrZakrzewski
PiotrZakrzewski / random_drop.py
Last active November 19, 2017 17:53
Random drop
import numpy as np
import random
ILOSC_KREGOW = 9
probabilities = np.array([np.exp(-x) for x in range(ILOSC_KREGOW) ])
normalized_probs = probabilities / np.sum(probabilities) # teraz ich suma to 1.0
print("Prawdopodobienswa po normalizacji", normalized_probs)
normalized_probs = list(normalized_probs)
@PiotrZakrzewski
PiotrZakrzewski / install_docker.sh
Created May 30, 2017 12:58
Install docker-engine Ubuntu 16.04
sudo apt-get update
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
apt-cache policy docker-engine
sudo apt-get install -y docker-engine
#!/bin/python
import click
from os import walk, makedirs
from os.path import join
from shutil import copy
@click.command()
@click.option('--source', help="""Path to the grails 2 project""", type=file)
@click.option('--destination',
help="""Path to the bootstrapped grails 3 project""", type=file)

#Patient Registration

  • presence of required fields. Taken from Study parameters.
  • Study exists in OC,
  • Site exist in the study
  • uniqueness of Study Subject ID (SSID) within file
  • width of SSID max 30 characters
  • gender is either "m" or "f"
  • uniqueness of PersonID in the Study
  • date format of Date of Enrollment
  • Width of Secondary ID max 30 characters
@PiotrZakrzewski
PiotrZakrzewski / getMetadataResponse.xml
Created April 28, 2016 15:14
Response to getMetadata request to OC 3.6
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<createResponse xmlns="http://openclinica.org/ws/study/v1">
<result xmlns="http://openclinica.org/ws/study/v1">Fail</result>
<error xmlns="http://openclinica.org/ws/study/v1">No study identifier was provided</error>
</createResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>