Skip to content

Instantly share code, notes, and snippets.

@GuillaumeDerval
GuillaumeDerval / covidScanJWT.py
Created September 21, 2021 14:02 — forked from ixe013/showJWT.py
Python script to decode a JWT. Works with JWT that are compressed (DEFLATE algorihtm) and incomplete padding
from __future__ import print_function
import base64
import json
import os.path
import pprint
import sys
import time
import zlib
import re
from typing import List
import abc
from inginious.frontend.plugin_manager import PluginManager
class SubmissionReader:
class __Button:
def __init__(self, submission_reader: "SubmissionReader", name: str, prio: int):
@GuillaumeDerval
GuillaumeDerval / mamaroo.py
Created July 30, 2020 16:17
Starting 4moms mamaRoo using Python
import asyncio
import random
from bleak import discover, BleakClient
ADDRESS = None
UUID = "622d0101-2416-0fa7-e132-2f1495cc2ce0" # can be found by connecting to the mamaRoo and inspecting the thing it advertises.
async def find_mamaroo():
if ADDRESS is not None:
@GuillaumeDerval
GuillaumeDerval / extract_euromomo.py
Last active April 26, 2020 14:47
Extract euromomo plot data
import json
import requests
from bs4 import BeautifulSoup
# Change this
OUTPUT_FILE = 'euromomo.json'
# Change this if the script breaks
BASE_PAGE = "https://www.euromomo.eu/graphs-and-maps/"
JS_FILE_PATTERN = "src-templates-graphs-and-maps-js"
@GuillaumeDerval
GuillaumeDerval / log_handler_slack.py
Last active June 5, 2021 10:01
A --log-handler-script log script for snakemake that pushes the status to Slack
# License: MIT
import socket
from slacker import Slacker
import datetime
import time
import threading
SLACK_TOKEN = 'xoxb-00000000000-000000000000-000000000000000000000000'
CHANNEL_NAME = "your-channel-on-slack"
@GuillaumeDerval
GuillaumeDerval / performance_backend.py
Created January 21, 2020 13:16
Performance test for INGInious
import asyncio
import logging
import time
from multiprocessing import Process
from zmq.asyncio import ZMQEventLoop, Context
from inginious.agent import Agent
from inginious.backend.backend import Backend
from inginious.client.client import Client
from inginious.common.messages import BackendKillJob, BackendNewJob
import java.util.*;
/**
* A mutable map for Integer keys based on a trie using the binary representation of keys
*
* @param <V> values to be contained in the structure
*/
public class MutableIntMap<V> extends AbstractMap<Integer, V> implements NavigableMap<Integer, V> {
protected int treeSize;
protected int[] tree;
Host studssh.info.ucl.ac.be studssh
User gderval
IdentityFile ~/.ssh/id_rsa_ingi
Host !studssh.info.ucl.ac.be !studssh *.info.ucl.ac.be baluran bibinoi bulusan calbuco cayambe chacana colachi davidof denison furnas kadovar khangar tibesti trident tsurumi virunga vulcano yunaska permeke tuteur inginious stromboli studmanager
ProxyCommand ssh -4 studssh.info.ucl.ac.be -W %h:%p
IdentityFile ~/.ssh/id_rsa_ingi
Host vega.ulb.ac.be
ProxyCommand ssh -4 studssh.info.ucl.ac.be -W %h:%p
@GuillaumeDerval
GuillaumeDerval / gist:fb219569c7e03a938f9b
Last active September 2, 2015 14:22
Roadmap 2 for INGInious
  • Use gevent
    • For now we start threads for each agent/connection/job/...
    • This is inneficient, as most of them only wait for one or other socket (either from Docker or from RPyC)
    • Using gevent will be faster and pose less stress to the OS, that is already way too stressed by Docker
    • This needs some work:
  • Websockets? To handle the task page (status update of jobs)
  • probably needs gevent
@GuillaumeDerval
GuillaumeDerval / scheduler.rst
Last active August 29, 2015 14:09
Note for the new scheduler of INGInious

Notes about the new scheduler for INGInious

Why does INGInious needs a (new) scheduler?

There is a problem with the assumption that the OS will handle the charge of multiples tasks running concurrently(right now, INGInious immediately launches tasks it receives, (nearly) without limits), mainly because of memory usage.

For a strange reason, processes are never/not enough put to swap, leading to OOM in other containers.