Skip to content

Instantly share code, notes, and snippets.

View bmpvieira's full-sized avatar

Bruno Vieira bmpvieira

  • Lifebit
View GitHub Profile
@bmpvieira
bmpvieira / docker-osx-install.sh
Created January 26, 2014 20:05
Docker running natively in OSX connected to daemon running inside Vagrant
#!/bin/bash
# Docker running natively in OSX connected to daemon running inside Vagrant
#
# This allows to use Docker natively in an OSX terminal, connected to a docker
# daemon running inside a CoreOS VM in Vagrant. Shared folder enabled through NFS.
#
# I tried to use [dvm](https://github.com/fnichol/dvm) but got issues with
# networking (#4) and shared folder (#7), so I just switched to CoreOS and
# added the settings for it to work like dvm.
@bmpvieira
bmpvieira / watable-controller.coffee
Last active December 20, 2015 03:09
CoffeeScript and JavaScript examples of using WATable with Express.js and Jade, with button to download CSV.
app.get '/watable', (req, res, next) ->
res.render 'watable'
app.get '/data.json', (req, res, next) ->
UserModel.find {}, 'email firstname lastname', (err, users) ->
return next err if err
rows = []
for user in users
user = user.toObject()
@bmpvieira
bmpvieira / blastXMLtoJSON.coffee
Created February 13, 2013 09:25
Convert NCBI's Blast XML results to JSON
# blastXMLtoJSON.coffee | 2013 Bruno Vieira [mail@bmpvieira.com]
#
# This script converts NCBI's Blast XML results to JSON
#
# For small files, it parses everything into a object in memory and
# writes the result to the output file in the end.
# For big files, it will write each Blast “Iteration” object separately,
# one per line, to avoid memory limits.
#
# Usage: coffee blastXMLtoJSON.coffee blast_results.xml output.json
@bmpvieira
bmpvieira / getMycorSequences.coffee
Last active December 12, 2015 00:18
This script fetches sequences from MycorWeb Blast result links.
# getMycorSequences.coffee
# This script fetches sequences from MycorWeb Blast result links.
#
# links file must be provided and can be obtained with getMycorLinks.coffee:
# https://gist.github.com/4683065
#
# Dependencies: casperjs
# Usage: casperjs getMycorSequences.coffee fileWithLinks
# Example: casperjs getMycorSequences.coffee sequencesLinks:0-4275.txt
# Author: Bruno Vieira (mail@bmpvieira.com)
@bmpvieira
bmpvieira / getMycorLinks.coffee
Last active December 12, 2015 00:18
This script fetches all the sequences links from a MycorWeb Blast result.
@bmpvieira
bmpvieira / youtubePlaylistParser.js
Created October 2, 2012 16:49
Simple Youtube playlist parser using JSONStream
/*
author: bmpvieira
license: WTFPL
description: Simple Youtube playlist parser using https://github.com/dominictarr/JSONStream
usage example: node youtubePlaylistParser.js PLt4dwg5cC5TSqHR44YK0UQ_8TSG8YtZtI | cclive -f best -c
*/
var request = require('request');
var JSONStream = require('JSONStream');
@bmpvieira
bmpvieira / cwtool with GUIX
Last active September 18, 2015 03:00
Put this inside python.scm
(define-public python-cwltool
(package
(name "python-cwltool")
(version "1.0.20150916041152")
(source
(origin
(method url-fetch)
(uri (string-append
"https://pypi.python.org/packages/source/c/cwltool/cwltool-"
version
@bmpvieira
bmpvieira / bionode-request.js
Created July 30, 2015 13:04
Get stuff from NCBI with custom path
var fs = require('fs')
var ncbi = require('bionode-ncbi')
var request = require('request')
var through = require('through2')
var _ = require('lodash')
var property = 'README.txt'
var requestStream = through.obj(function(obj, enc, next) {
var fileName = _.get(obj, property).split('/')[5]
@bmpvieira
bmpvieira / r-base-lea.sh
Created February 25, 2015 09:14
Setup R with LEA package (because it segfaults on OSX) http://membres-timc.imag.fr/Olivier.Francois/LEA/software.htm
# Setup R with LEA package (because it segfaults on OSX)
# http://membres-timc.imag.fr/Olivier.Francois/LEA/software.htm
# Run one by one the following commands
brew install boot2docker docker
boot2docker init
boot2docker up
docker run -it -v ~/Downloads:/Downloads r-base
docker run -it r-base
install.packages("/Downloads/LEA_0.2.tar", repos = NULL, type = "source")