Skip to content

Instantly share code, notes, and snippets.

View arteymix's full-sized avatar

Guillaume Poirier-Morency arteymix

View GitHub Profile
@arteymix
arteymix / slurm-primer.md
Last active April 8, 2024 06:33
Slurm Primer

Slurm Primer!

I decided to write this primer to encourage the usage the lab members to use our compute cluster.

We don’t really do distribute computing with tasks that run across nodes/processes and inter-communicate. Thus, I’ll focus on the case where only one task is asked (i.e. --tasks=1).

Slurm vocabulary

@arteymix
arteymix / AbstractAsyncFactoryBean.java
Created December 18, 2022 06:01
Prototype for asychronous Spring bean factory
package ubic.gemma.persistence.util;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import javax.annotation.OverridingMethodsMustInvokeSuper;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@arteymix
arteymix / rdp_web_client.py
Created June 14, 2021 16:42
RDP Web Client
import requests
import pandas as pd
from tqdm import tqdm
from os.path import join
from functools import wraps
def unpaginate(endpoint):
"""Unpaginate a paginated Spring endpoint by yielding from the pages content"""
@wraps(endpoint)
def f(*args, page_size=20):
@arteymix
arteymix / cadd2vgf
Created November 5, 2019 21:29
Convert CADD annotations to VCF
#!/usr/bin/env python
#
# Converts the CADD format to VCF
#
import sys
import csv
print('''##fileformat=VCFv4.2
project('test', 'c', 'vala')
glib_dep = dependency('glib-2.0')
config = configure_file(input: 'build.vala',
output: 'build.vala',
configuration: configuration_data())
executable('main', ['main.vala', config],
dependencies: [glib_dep])
class ErrorHandler {
public signal void publish (Error err);
private static ErrorHandler _default;
public static ErrorHandler get_default () {
if (_default == null) {
_default = new ErrorHandler ();
}
return _default;
}
}
/* gocl-0.2.vapi generated by vapigen, do not modify. */
[CCode (cprefix = "Gocl", gir_namespace = "Gocl", gir_version = "0.2", lower_case_cprefix = "gocl_")]
namespace Gocl {
[CCode (cheader_filename = "gocl.h", type_id = "gocl_buffer_get_type ()")]
public class Buffer : GLib.Object, GLib.Initable {
[CCode (has_construct_function = false)]
public Buffer (Gocl.Context context, uint flags, size_t size, uint64 host_ptr);
public unowned Gocl.Context get_context ();
public unowned Gocl.Event map (Gocl.Queue queue, Gocl.BufferMapFlags map_flags, size_t offset, size_t size, GLib.List<Gocl.Event>? event_wait_list);
@arteymix
arteymix / Makefile
Created October 5, 2016 15:23
Generate standalone Python zip archive for Meson tooling
TOOLS := meson mesonconf mesonintrospect wraptool
all: $(TOOLS)
%: %.py
cp meson.py __main__.py
zip $@.zip __main__.py mesonbuild/**/*.py
echo '#!/usr/bin/env python3' > $@
cat $@.zip >> $@
chmod +x $@
@arteymix
arteymix / simple-custom.vala
Last active September 30, 2016 17:22
Layout for a typical GLib.TypeModule implementation (replace `Simple` by the name of your class/interface)
using GLib;
[ModuleInit]
public Type simple_init (TypeModule type_module)
{
return typeof (CustomSimple);
}
public class CustomSimple : Simple
{
@arteymix
arteymix / example.vala
Last active July 2, 2017 06:08
Example of non-blocking execution in GTK with Vala (run with `vala --pkg=gtk+-3 example.vala`)
using Gtk;
Button button;
public static int main (string[] args) {
Gtk.init (ref args);
var window = new Window ();
window.title = "Count without blocking the UI";
window.border_width = 10;
window.window_position = WindowPosition.CENTER;