Skip to content

Instantly share code, notes, and snippets.

View rvalieris's full-sized avatar

Renan Valieris rvalieris

  • A. C. Camargo Cancer Center
  • São Paulo, Brazil
View GitHub Profile
@rvalieris
rvalieris / test.R
Last active January 22, 2016 13:06
cube sum test example
# run as R -d valgrind -f test.R
library(Rcpp)
sourceCpp("test.cpp")
--- a/configure 2017-08-22 07:59:12.000000000 -0300
+++ b/configure 2018-01-16 16:41:25.378540069 -0200
@@ -3298,7 +3298,7 @@
## Download NLopt source code
## curl -O http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz
- $("${R_HOME}/bin/Rscript" --vanilla -e "download.file(url='${NLOPT_URL}', destfile='${NLOPT_TGZ}')")
+ $("${R_HOME}/bin/Rscript" --vanilla -e "download.file(url='${NLOPT_URL}', destfile='${NLOPT_TGZ}', method='curl', extra='-L')")
## Extract NLopt source code and remove .tar.gz
@rvalieris
rvalieris / build.sh
Created February 19, 2018 18:43
rakudo conda recipe
#!/bin/bash
set -e
perl Configure.pl --backend=moar --gen-moar --prefix="$PREFIX"
make
make rakudo-test
make install
change_triplet <- c(
"C>A:ACA","C>A:ACC","C>A:ACG","C>A:ACT","C>A:CCA","C>A:CCC","C>A:CCG",
"C>A:CCT","C>A:GCA","C>A:GCC","C>A:GCG","C>A:GCT","C>A:TCA","C>A:TCC",
"C>A:TCG","C>A:TCT","C>G:ACA","C>G:ACC","C>G:ACG","C>G:ACT","C>G:CCA",
"C>G:CCC","C>G:CCG","C>G:CCT","C>G:GCA","C>G:GCC","C>G:GCG","C>G:GCT",
"C>G:TCA","C>G:TCC","C>G:TCG","C>G:TCT","C>T:ACA","C>T:ACC","C>T:ACG",
"C>T:ACT","C>T:CCA","C>T:CCC","C>T:CCG","C>T:CCT","C>T:GCA","C>T:GCC",
"C>T:GCG","C>T:GCT","C>T:TCA","C>T:TCC","C>T:TCG","C>T:TCT","T>A:ATA",
"T>A:ATC","T>A:ATG","T>A:ATT","T>A:CTA","T>A:CTC","T>A:CTG","T>A:CTT",
change_triplet <- c(
"C>A:ACA","C>A:ACC","C>A:ACG","C>A:ACT","C>A:CCA","C>A:CCC","C>A:CCG",
"C>A:CCT","C>A:GCA","C>A:GCC","C>A:GCG","C>A:GCT","C>A:TCA","C>A:TCC",
"C>A:TCG","C>A:TCT","C>G:ACA","C>G:ACC","C>G:ACG","C>G:ACT","C>G:CCA",
"C>G:CCC","C>G:CCG","C>G:CCT","C>G:GCA","C>G:GCC","C>G:GCG","C>G:GCT",
"C>G:TCA","C>G:TCC","C>G:TCG","C>G:TCT","C>T:ACA","C>T:ACC","C>T:ACG",
"C>T:ACT","C>T:CCA","C>T:CCC","C>T:CCG","C>T:CCT","C>T:GCA","C>T:GCC",
"C>T:GCG","C>T:GCT","C>T:TCA","C>T:TCC","C>T:TCG","C>T:TCT","T>A:ATA",
"T>A:ATC","T>A:ATG","T>A:ATT","T>A:CTA","T>A:CTC","T>A:CTG","T>A:CTT",
#!/usr/bin/env python3
import requests
import hashlib
import getpass
password = getpass.getpass()
hash = hashlib.sha1(password.encode("utf8")).hexdigest().upper()
head, rest = hash[:5], hash[5:]
r = requests.get("https://api.pwnedpasswords.com/range/%s" % head)
@rvalieris
rvalieris / parallel_count_matrix.R
Last active June 20, 2018 18:17
parallel genCountMatrixFromVcf
library(signeR)
library(VariantAnnotation)
library(BSgenome.Hsapiens.UCSC.hg19)
library(BiocParallel)
register(MulticoreParam(workers=5)) # use 5 cores
vcf = readVcf("a.vcf")
split_vcf = split(vcf,ceiling(seq_along(vcf)/1000)) # split vcf into chunks of 1000 rows
From ce9d3edd1b0f3397cf6558a650d1a0ee2edbb823 Mon Sep 17 00:00:00 2001
From: rvalieris <[email protected]>
Date: Fri, 21 Sep 2018 21:16:05 -0300
Subject: [PATCH] uncomment sysroot change
---
recipe/build.sh | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/recipe/build.sh b/recipe/build.sh
@rvalieris
rvalieris / get_unused_port.py
Created August 23, 2019 14:47
find a unused port on linux
import psutil
import random
ports = set(map(lambda k: k.laddr.port,psutil.net_connections()))
print(random.choice(list(set(range(2000,10000)) - ports)))
import pyvips
a = pyvips.Image.new_from_file('input.svs')
image_desc = a.get('tiff.ImageDescription')
a.set_type(pyvips.GValue.gstr_type, 'image-description', image_desc)
a.tiffsave('output.tif', pyramid=True, tile=True, compression='jpeg', tile_height=256, tile_width=256, Q=80)