Skip to content

Instantly share code, notes, and snippets.

View rejsmont's full-sized avatar
💉
Pfized Twice

Radoslaw Ejsmont rejsmont

💉
Pfized Twice
  • CRI
  • Paris, France
View GitHub Profile
@rejsmont
rejsmont / AclFilter.php
Last active February 14, 2019 08:10
ACL filter for Doctrine QueryBuilder and Query. Supports multiple filters applied to a single query, entity inheritance and role hierarchies.
<?php
/*
* Copyright 2013 Radoslaw Kamil Ejsmont <radoslaw@ejsmont.net>
*
* Original code by mailaneel is available at
* https://gist.github.com/mailaneel/1363377
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@rejsmont
rejsmont / compact.py
Last active August 29, 2015 14:27
Compact sparse matrix
#! /usr/bin/python
from __future__ import division
from __future__ import print_function
import csv
import argparse
import numpy
import numpy.linalg
import numpy.random
@rejsmont
rejsmont / covid-19-wikipedia.py
Last active March 20, 2020 20:20
Fetch COVID-19 data for a country from Wikipedia
import requests
import pandas as pd
def get_wikipedia_data(country):
s = requests.Session()
url = "https://en.wikipedia.org/w/api.php"
p = {
"action": "query",
@rejsmont
rejsmont / chrome-stream-dl
Created March 21, 2020 12:15
Download stream from Chrome playlist cURL
#!/usr/bin/env python3
import os
print("Enter output filename:")
name = input()
print("Paste cURL command string:")
cmd = input()
headers = []
@rejsmont
rejsmont / anr_check.py
Created September 11, 2020 15:19
Check if the results for ANR grant committee are available
import re, requests
from urllib.request import urlopen
from lxml import etree
def committee_available(comm):
url = 'https://anr.fr/fr/detail/call/appel-a-projets-generique-2020/'
headers = {'Content-Type': 'text/html',}
response = requests.get(url, headers=headers)
html = response.text
htmlparser = etree.HTMLParser()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rejsmont
rejsmont / swarmify.py
Last active January 5, 2021 16:03
Create a swarm in native matplotlib of out any scatter plot series
# Based on swarmplot code from seaborn - slightly adapted to take either a PathCollection or a list of PathCollections,
# thus enabling a hybrid swarm of scatter plots using different markers.
# Source: https://github.com/mwaskom/seaborn/blob/f1852b584c3edb750cfc0ee7c6cf6b34453ca5c9/seaborn/categorical.py
# License and copyright: https://github.com/mwaskom/seaborn/blob/master/LICENSE
# Comments from the source removed for brevity
def swarmify(ax, swarm, width, **kws):
def could_overlap(xy_i, swarm, d):
_, y_i = xy_i
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.