Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Hacking away

Samuel Lampa samuell

💻
Hacking away
View GitHub Profile
View filternonexistent_component.go
// Workflow written in SciPipe.
// For more information about SciPipe, see: http://scipipe.org
package main
import sp "github.com/scipipe/scipipe"
func main() {
// Create a workflow, using 4 cpu cores
wf := sp.NewWorkflow("my_workflow", 4)
View globfiles_sciluigi.py
import luigi
import sciluigi as sl
# ... snip ...
class GlobFiles(sl.Task):
globdir = luigi.Parameter()
in_depend = None
@samuell
samuell / luigi_time_tasks_example.py
Last active Apr 25, 2020
How to output the execution time of tasks in the luigi workflow system, as discussed [here](https://groups.google.com/d/msg/luigi-user/uivbf-luX9w/z0GCKKsIefoJ)
View luigi_time_tasks_example.py
import luigi
import time
class TimeTaskMixin(object):
'''
A mixin that when added to a luigi task, will print out
the tasks execution time to standard out, when the task is
finished
'''
@luigi.Task.event_handler(luigi.Event.PROCESSING_TIME)
View dump_nodes_from_drupal6.sql
SELECT node.title,timestamp,node_revisions.body
FROM node
LEFT JOIN node_revisions ON node.vid=node_revisions.vid
INTO OUTFILE '/tmp/nodes.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
@samuell
samuell / luigi_dynamic_dependency_graph_definition.py
Last active Mar 21, 2020
Dynamically specify luigi data flow
View luigi_dynamic_dependency_graph_definition.py
import luigi
class ATask(luigi.Task):
def output(self):
return luigi.LocalTarget("atask_output.txt")
def run(self):
with self.output().open("w") as outfile:
outfile.write("Test")
@samuell
samuell / select_parent_luigi_task_by_param.py
Created Dec 3, 2013
Demonstrates how one can select which parent task a luigi task should depend on, by specifying the parent task class name via a parameter.
View select_parent_luigi_task_by_param.py
import luigi
class ATask(luigi.Task):
def output(self):
return luigi.LocalTarget("atask_output.txt")
def run(self):
with self.output().open("w") as outfile:
outfile.write("Test")
@samuell
samuell / Makefile
Created Sep 12, 2019
Example Makefile for building a coverage report for .Net Core 2.2 projects on Windows 10 in MSYS2/Bash
View Makefile
#!/bin/bash
# --------------------------------------------------------------------------------
# This script uses the coverlet tool to generate code coverage statistics about the tests
# For more info about coverlet: https://github.com/tonerdo/coverlet
# Author: Samuel Lampa
# --------------------------------------------------------------------------------
./bin/Debug/netcoreapp2.2/MyApp.Tests.dll:
echo "Installing any uninstalled dependencies, by executing dotnet restore ..."
dotnet restore
dotnet build
View eq-centric-2.go
package main
// Source code for this experiment: https://github.com/samuell/gormula
import (
"fmt"
"math"
)
func main() {
View eq-centric-1.go
monthlyPaymentUSD := Mul(
Div(
Mul(
Div(Val(rate),
Val(1200.0)),
Exp(
Add(
Val(1.0),
Div(
Val(rate),
View revcomplement.dot
digraph "DNA Base Complement Workflow" {
rankdir=LR;
graph [fontname="Arial",fontsize=13,color="#384A52",fontcolor="#384A52"];
node [fontname="Arial",fontsize=11,color="#384A52",fontcolor="#384A52",fillcolor="#EFF2F5",shape=box,style=filled];
edge [fontname="Arial",fontsize=9, color="#384A52",fontcolor="#384A52"];
"Base Complement" [shape=box];
"Make DNA" [shape=box];
"Reverse" [shape=box];
"Base Complement" -> "Reverse" [taillabel="compl", headlabel="in"];
"Make DNA" -> "Base Complement" [taillabel="dna", headlabel="in"];
You can’t perform that action at this time.