Skip to content

Instantly share code, notes, and snippets.

@idot
idot / setup.sh
Last active January 18, 2024 09:26 — forked from bradp/setup.sh
New Mac Setup Script
#!/bin/bash
#echo "Creating an SSH key for you..."
#ssh-keygen -t rsa
#echo "Please add this public key to Github \n"
#echo "https://github.com/account/ssh \n"
#read -p "Press [Enter] key after this..."
XCODE=$(xcode-select -p 1>/dev/null;echo $?)
if [ $XCODE -ne 0 ]; then
@idot
idot / per_item.nf
Created January 23, 2019 15:44
NextFlow results per item in set
#!/usr/bin/env nextflow
//the problem is 1, then the channel gets file(*) => UnixPath; > 1, then channel gets ArrayList<UnixPath>
starts=Channel.from(1,2,3,4)
process first {
input:
val start from starts
output:
@idot
idot / chr2num.R
Created February 18, 2016 09:00
converts chromosome names from Tair10 from ngsplot to numeric names
#!/usr/bin/env Rscript
#copy .metainfo and .chrnames.endsembl from orig tar.gz in subfolder and change
# chrnames, ID
#tar with tar -zcvf Tair10numeric.tar.gz Tair10numeric
convertRdata <- function(){
id <- "Tair10numeric"
dir.create(id, recursive=TRUE, show=FALSE )
@idot
idot / config.scala
Created November 26, 2013 15:24 — forked from retronym/config.scala
package scalaz.example
object Reader extends App {
/**
* Manual propagation of the environment (in the example, `contextRoot`.)
*/
object Config0 {
def fragment1(contextRoot: String) = <a href={contextRoot + "/foo"}>foo</a>
import java.io.{ BufferedReader, File, FileReader }
import scalaz._, Scalaz._, effect.IO, iteratee.{ Iteratee => I, _ }
object IterateeIOExample {
type ErrorOr[+A] = EitherT[IO, Throwable, A]
def openFile(f: File) = IO(new BufferedReader(new FileReader(f)))
def readLine(r: BufferedReader) = IO(Option(r.readLine))
def closeReader(r: BufferedReader) = IO(r.close())
@idot
idot / combinePlots.R
Last active December 16, 2015 00:18
combine ggplot2 plots
library(gridExtra)
getLegend <- function(tp.gplot, position="bottom", box="horizontal"){
tmp <- ggplot_gtable(ggplot_build(tp.gplot + theme(legend.position = position, legend.box = box)))
leg <- which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
legend <- tmp$grobs[[leg]]
return(legend)
}
#then extract height or width of legend
@idot
idot / ngGrid.js
Created November 11, 2012 14:27 — forked from mathwizard/ngGrid.js
Angular Grid
//////////////////////////////////////
/// Grid Directive to Angular 1.0.2
//////////////////////////////////////
// To use:
// <script>
// var app = angular.module('myapp', ['ngGrid']);
// var Ctrl = function($scope) { $scope.todos = [...] }
// </script>
// <div ng-app="myapp">
@idot
idot / CQRS_ES_Actor.scala
Created October 25, 2011 08:44 — forked from viktorklang/CQRS_ES_Actor.scala
CQRS and EventSourcing using Akka Actors
import scala.collection.mutable.ListBuffer
import akka.actor.{Actor,ActorRef}
import akka.actor.Actor._
import akka.routing.{ Listeners, Listen }
//Represents a domain event
trait Event
//A builder to create domain entities
trait EntityBuilder[Entity] {
@idot
idot / toIllu.py
Created October 10, 2011 16:52
converts 1.8+ illumina qualities somehow to 1.5+
#!/usr/bin/env python
def toIllu(c):
"""returns the 1.5 value of phred+33
>>> [toIllu(ord(n)) for n in["!",'"',"#","$","H","I","J"]]
['B', 'B', 'B', 'C', 'g', 'h', 'h']
"""
if c < 36:
return "B"
elif c > 73:
@idot
idot / tikz2pdf.py
Created July 26, 2011 10:05
converts .tikz to pdf files
#!/usr/bin/env python
#
# Copyright (c) 2007, Hans Meine <hans_meine@gmx.net>
# All rights reserved.
#
# This is licensed according to the new BSD license.
# Please send patches / comments, I would be happy about any feedback.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions