Skip to content

Instantly share code, notes, and snippets.

View vsoch's full-sized avatar
💭
rawr

Vanessasaurus vsoch

💭
rawr
View GitHub Profile
@vsoch
vsoch / singularity-python-import.txt
Last active November 28, 2016 05:29
This is a gist to quickly show how to use a python module (outside of a container) inside of a container (with a different python version) at runtime
# The steps we are going to follow are the following:
# 0) (Not required) look at versions and paths of python inside and outside container
# 1) Bootstrap the python:latest docker container into a Singularity image with the module directory as a bind point
# 2) Add the mapped directory (inside container) to the PYTHONPATH
# 3) import as usual!
# Outside Container
vanessa@vanessa-ThinkPad-T450s:~$ whoami
vanessa
@vsoch
vsoch / Singularity
Created February 2, 2017 01:13
a build specification file for a Singularity bootstrap for Joke
Bootstrap: docker
From: joke/hcppipelines
%runscript
exec /run.py "$@"
%post
# Make script executable
@vsoch
vsoch / Singularity
Created February 7, 2017 21:34
slc6-base Singularity build definition file
Bootstrap:docker
From:cern/slc6-base
%runscript
echo "Hi from slc6"
cat /etc/issue
%post
yum -y update
@vsoch
vsoch / Singularity
Created March 5, 2017 19:42
Testing graspit install via Singularity container
Bootstrap: docker
From: ubuntu:14.04
%runscript
echo "SINGULARITY RUNSCRIPT"
echo "Arguments received: $*"
exec /opt/anaconda3/bin/python "$@"
%post
@vsoch
vsoch / scrape_google_group.py
Created March 31, 2017 23:04
Scraper for Google Group - you will need to edit the last elements classes IDs, and the organization and group name
import json
from os.path import exists
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
class GoogleGroupsScraper(object):
""" A simple class to scrape a google group. """
@vsoch
vsoch / python_progress.py
Created April 10, 2017 23:56
Testing a python progress bar
import sys
import os
import time
def show_progress(iteration,total,length=100,min_level=0,carriage_return=True,suffix=None,symbol=None):
'''create a terminal progress bar, default bar shows for verbose+
:param iteration: current iteration (Int)
:param total: total iterations (Int)
:param length: character length of bar (Int)
@vsoch
vsoch / sniff_dicom.py
Created April 23, 2017 02:09
example of using pydicom to summarize and "sniff" (meaning estimate) counts for a filter
from glob import glob
import dicom
import pandas
import random
import json
import os
# wget https://bootstrap.pypa.io/get-pip.py
# sudo python3 get-pip.py
# sudo pip3 install pydicom
@vsoch
vsoch / test_multiprocessing.py
Created April 24, 2017 19:39
testing multiprocessing for downloads with Singularity
from glob import glob
import multiprocessing
import itertools
import time
import os
###################################################################
# Setup
# -----------------------------------------------------------------
@vsoch
vsoch / Singularity
Created May 9, 2017 01:08
example to install STAR and openmpi
Bootstrap:docker
From: centos:7
%labels
CREATOR vsochat@stanford.edu
%environment
PATH=$PATH/STAR/bin/Linux_x86_64
%post
@vsoch
vsoch / run.sh
Created June 9, 2017 04:24
testing a derivation of the function to return a datetime string (for STRIDE) from two fields in a dicom header (one for date, one for time)
#!/bin/bash
python test_timeparser.py
# Asking for datetime for date:20040826 and time:185744
# 2004-08-26T18:57:44Z
# Asking for datetime for date:20040826
# 2004-08-26T00:00:00Z