Skip to content

Instantly share code, notes, and snippets.

View grst's full-sized avatar

Gregor Sturm grst

  • Boehringer Ingelheim
  • Biberach, DE
  • 07:44 (UTC +02:00)
View GitHub Profile
@grst
grst / rsession.sh
Created November 30, 2018 08:27
Use conda-env for rstudio-server
#!/bin/bash
USER=`whoami`
source /etc/profile
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
source /storage/apps/dotfiles/bashrc.sh
@grst
grst / server.py
Created January 20, 2019 15:55
slow dropdown in dash
import dash
import dash_html_components as html
import dash_core_components as dcc
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
dcc.Dropdown(
id='dropdown-selector',
name: single_cell_analysis
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- pandas =0.23.4
- scanpy =1.3.7
- r-base =3.5.1
- r-rmarkdown =1.10
@grst
grst / ipynb.html
Last active October 16, 2019 09:32
pandoc toc from ipynb example files
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>test</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
@grst
grst / layout.py
Last active March 26, 2020 07:36
Layout graphs with many disconnected components using python-igraph. - Adapted from https://stackoverflow.com/questions/53120739/lots-of-edges-on-a-graph-plot-in-python
import igraph as ig
import numpy as np
from itertools import combinations
def layout_components(
graph: ig.Graph,
component_layout: str = "fr",
arrange_boxes: str = "dense",
pad_x: float = 1.0,
pad_y: float = 1.0,
@grst
grst / zettlr-multi-instance.md
Last active June 23, 2020 14:58
Run multiple instances of zettlr

It is currently not possible to run multiple instances of Zettlr (Zettlr/Zettlr#243).

As a workaround, I managed to run multiple instances of zettlr side-by-side by running them as different users.

For me this seems to work reasonably well, but this can lead to corruption of your settings or your notes -- Use at own risk.

Setup

# create a new user
@grst
grst / jupyter-nextflow-plugin.md
Created October 26, 2020 13:32
draft of nextflow/notebook integration

jupyter nextflow plugin

It would be great to have a tighter integration with jupyter notebooks/Rmd notebooks.

See also Reportsrender v2 / Executable book project Reportsrender v2.

Parametrization with papermill/rmarkdown works, but is quite a bit of overhead. It should be possible to execute the notebooks from outside the pipeline (for development) and from within the pipeline using the results from the previous processes (in production)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
"""
Query GitHub API for the status of the GitHub actions runs associated
with a commit.
Requirements: `pygithub`, the rest is standard lib.
"""
from github import Github