Skip to content

Instantly share code, notes, and snippets.

View pauca's full-sized avatar

Pau Carrió pauca

  • Barcelona, Spain
View GitHub Profile
@pauca
pauca / R_chem_snippets.R
Created October 13, 2015 09:21
R_chem_snippets
# CAS -> smiles with CACTUS server
sapply(cas, function(id){
require(RCurl)
return(getURL(paste("http://cactus.nci.nih.gov/chemical/structure/",id,"/smiles",sep="")))
})
def f1 = {
println("f1")
true
}
def f2 = {
println("f2")
@pauca
pauca / examplePasteAndShow.html
Created January 18, 2017 10:19
Example of jQuery of Paste on textarea and do an action
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Paste&Go</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" ></script>
<script>
$( document ).ready(function() {
console.log( "ready!" );
@pauca
pauca / RqcScript.R
Last active January 19, 2017 11:22
Rqc - memory error reproduce
library(Rqc)
fs <- "corrupted.fastq"
qa <- rqcQA(fs,sample=F)
sessionInfo()
@pauca
pauca / replaceSymLinks.sh
Last active April 11, 2017 13:12
replace symbolik links in current directory by originals, and remove them
@pauca
pauca / AkkaStreamTemplate.scala
Created June 9, 2017 15:34
Basic Akka Stream Template: read, transform, write
/*
build.sbt
name := "AkkaStreamTemplate"
version := "0.1-SNAPSHOT"
scalaVersion := "2.12.2"
libraryDependencies ++= {
Seq(
@pauca
pauca / binaryDistances.R
Last active June 19, 2017 12:28
binary distances R ( tanimoto)
# http://www.sequentix.de/gelquest/help/distance_measures.htm
bdist <- function( x, y , method ){
a <- sum( x == 1 & y == 1)
b <- sum( x == 1 & y == 0)
c <- sum( x == 0 & y == 1)
d <- sum( x == 0 & y == 0)
switch(method,
tanimoto = (a+d)/(a+2*(b+c)+d),
@pauca
pauca / GzipCompressor.scala
Last active September 22, 2017 12:51
Gist to stream strings to a akka queue that gzips and stores
import akka.actor._
import akka.actor.ActorLogging
import akka.actor.ActorSystem
import akka.stream._
import akka.stream.actor.ActorSubscriberMessage._
import akka.stream.actor._
import akka.stream.scaladsl._
import akka.{ NotUsed, Done }
import akka.util.ByteString
import java.io._
@pauca
pauca / get_script_dir.sh
Created January 23, 2018 14:28
get_script_dir with bash
#!/bin/bash
set -e
set +u
get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"
# While $SOURCE is a symlink, resolve it
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
@pauca
pauca / gist:24a194c867e11f1730bd4f172da97a0d
Created March 15, 2018 14:42
scala php crypto ciper match
import javax.crypto._
import javax.crypto.spec._
import java.util.Base64
val message= "Hello"
val secret = "eGkmaYd3PE9x3Z221x7b2nXmJ7ACGrjf"
val ivString = "0123456789012345"
val ciper: Cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")