Skip to content

Instantly share code, notes, and snippets.

View vinnyoodles's full-sized avatar
🏡
Working from home

Vincent Le vinnyoodles

🏡
Working from home
View GitHub Profile
@vinnyoodles
vinnyoodles / index.js
Created February 6, 2018 17:44
sample express server with mongodb
var express = require('express');
var mongojs = require('mongojs');
var db = mongojs(process.env.MONGO_URL || 'mongodb://localhost:27017/local');
var app = express();
app.use('/public', express.static('public'))
app.listen(3000, () => console.log('listening on *:3000'));
@vinnyoodles
vinnyoodles / FastViromeExplorer.out
Created February 10, 2018 18:30
Output when running FastViromeExplorer shell script
This file has been truncated, but you can view the full file.
# Output for running the command:
# > kallisto quant -i test/testset-kallisto-index.idx -o test-output --pseudobam test/reads_1.fq test/reads_2.fq | samtools view -bS - | samtools view -h -F 0x04 -b - | samtools sort - -o test-output/FastViromeExplorer-reads-mapped-sorted.sam > foo
[quant] fragment length distribution will be estimated from the data
[index] k-mer length: 31
[index] number of targets: 97
[index] number of k-mers: 515,417
[index] number of equivalence classes: 101
[quant] running in paired-end mode
[quant] will process pair 1: test/reads_1.fq
@vinnyoodles
vinnyoodles / mesopelagic.sh
Last active March 27, 2018 02:45
CS 4884 HW
#!/bin/bash
#PBS -l walltime=24:00:00
#PBS -l procs=4
#PBS -q normal_q
#PBS -A cs4884s18
#PBS -W group_list=newriver
# Purge existing modules.
module purge
@vinnyoodles
vinnyoodles / tree.html
Last active March 28, 2018 20:41
Interactive NGS Simulator Tree
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tree Example</title>
<style>
.node {
cursor: pointer;
}
.node circle {
@vinnyoodles
vinnyoodles / solution.md
Last active July 12, 2020 15:42
Deepest Leaves Sum

Question

Given a binary tree, return the sum of values of its deepest leaves.

Solutions

Recursive Depth First Search

Intuition

Find the largest depth first, then sum up each node at the largest depth

Algorithm

public int findMax(int n, int[] arr) {
// let freqMap be a map where the keys are the elements in arr
// and the values are its frequency or the number of occurences in arr
List<Integer> list = new ArrayList<>();
for (int i = 1; i <= n; i++) {
if (!freqMap.contains(i)) continue;
for (int count = 0; count < freqMap.get(i); count++) {
list.add(i);