Skip to content

Instantly share code, notes, and snippets.

@oweidner
oweidner / pystrap.sh
Created October 27, 2011 22:01
A Python Environment Bootstrapper
#!/bin/bash
## Description:
##
## pystrap.sh is a shell script to bootstrap a Python environment
## in user space that includes pip and virtualenv. It can be used
## to bootstrap a Python environment remotely, e.g., on a cluster
## where setuptools, virtualenv, etc. are usually not installed.
##
## Example: pystrap via Globus:
@oweidner
oweidner / air_via_globus.rsl
Created October 28, 2011 17:57
Globus RSL script to booststrap and test Air
(* RSL script that bootstraps Air (http://oweidner.github.com/air/) *)
(* on a remote machine and uses it to execute /bin/id. *)
(* *)
(* Copyright 2011 Ole Christian Weidner (ole.weidner@me.com) *)
(* Latest version: https://gist.github.com/1322898 *)
(* *)
(* Run it like this (replace GRAM URL with your own) *)
(* globusrun -b -r tuscany.med.harvard.edu:2119/jobmanager-fork -f job.rsl *)
&(executable=/bin/sh)
@oweidner
oweidner / air_via_pbs.sh
Created October 28, 2011 19:14
PBS/TORQUE script to bootstrap and test Air
#!/bin/bash
## PBS script that bootstraps Air (http://oweidner.github.com/air/)
## on a remote machine and uses it to execute /bin/id.
##
## Copyright 2011 Ole Christian Weidner (ole.weidner@me.com)
## Latest version: https://gist.github.com/gists/1323198
##
## Run it with qsub: qsub air_via_pbs.sh
## or even directly via curl/qsub:
@oweidner
oweidner / pbssh.py
Created November 10, 2011 02:43
Bliss Example: Run a BFAST task on a remote cluster via PBS+SSH
#!/usr/bin/env python
import sys, time
import bliss.saga as saga
def main(jobno, session, jobservice):
bfast_base_dir = saga.Url("sftp://india.futuregrid.org/N/u/oweidner/software/bfast/")
try:
@oweidner
oweidner / bfast.condor
Created January 13, 2012 03:37
Submitting BFAST via Condor on OSG
universe=vanilla
executable=/home/oweidner/software/bfast/bin/bfast
transfer_executable=True
when_to_transfer_output = ON_EXIT
transfer_input_files=/home/oweidner/software/bfast/data/small/reference/hg_2122.fa,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.10.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.1.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.2.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.3.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.4.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.5.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.6.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.7.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.8.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.9.1.bif,/home/oweidner/software/bfast/data/small/reference/hg_2122.fa.cs.brg,/home/oweidner
@oweidner
oweidner / bfast.saga.py
Created January 13, 2012 05:29
Submitting BFAST via SAGA/Condor on OSG
import saga
try:
jd = saga.job.description()
jd.set_attribute ("Executable", "/home/oweidner/software/bfast/bin/bfast")
jd.set_vector_attribute("Arguments", ["match", "-r", "reads.10.fastq", "-A", "1", "-f", "hg_2122.fa"])
jd.set_attribute ("Output", "my_out.$(Cluster).$(Process)")
jd.set_attribute ("Error", "my_err.$(Cluster).$(Process)")
input_files = ["/home/oweidner/software/bfast/data/small/reference/hg_2122.fa > hg_2122.fa",
@oweidner
oweidner / sample_date.py
Created January 25, 2012 16:32
sample_date.py
""" Example application demonstrating how to submit a simple
/bin/date job with BigJob.
"""
import os
import time
import pdb
import sys
@oweidner
oweidner / bigjob_bliss_echo_test.py
Created February 7, 2012 00:40
BigJob/Bliss Echo Test (PhD-Research/1styearrev/experiments/01_bfast_benchmark)
""" Example application demonstrating how to submit a simple
/bin/echo job with BigJob.
"""
import os
import time
import pdb
import sys
@oweidner
oweidner / gitpoller.sh
Last active January 21, 2022 20:49
This scripts clones and periodically updates a remote git repository.
#!/bin/bash -l
# Copyright 2022 Ole Weidner (ole.weidner@codewerft.net)
# Licensed under the MIT License
# -----------------------------------------------------------------------------
# Global variables.
#
UPDATE_INTERVAL=300
BUILD_COMMAND="true"
@oweidner
oweidner / superformula_2d.jl
Last active September 5, 2022 19:09
Generalized SuperformulaU in Julia
using Pkg
Pkg.add("Plots")
using Plots
gr()
# Generalized SuperformulaU 2D returns the radius for a given angle phi.
SuperformulaU2D(phi, a, b, y, z , n1, n2, n3) =
( abs( cos(y*phi/4) / a )^n2 + abs( sin(z*phi/4) / b )^n3 ) ^ (-1/n1)