Skip to content

Instantly share code, notes, and snippets.

@s4553711
s4553711 / note-of-23andme-script
Created August 29, 2016 07:29
Note about 23andme script to translate array to VCF
rs123 chr1 300 AB
-> no rsid -> rsid = "."
-> AA =~ /-*/ -> next
-> [D,I]B -> next
-> if not find chr1:300 in ref -> log error
-> if find chr1:300 in ref -> stre $ref
-> if $ref == PASS -> next
-> processAltAndGenotype (AB, $ref)
import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
public class NioRunner {
public static void main(String[] args) {
SocketChannel client[] = new SocketChannel[args.length];
try {
@s4553711
s4553711 / vimrc
Last active December 15, 2016 06:38
Personal .vimrc backup
set nocompatible
filetype on
set hls
set encoding=utf-8
set nu
set tabstop=4
set softtabstop=4
set shiftwidth=4
" set the runtime path to include Vundle and initialize
@s4553711
s4553711 / 349.cpp
Created March 31, 2017 16:31
leetcode-349
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> intersection(vector<int>& n1, vector<int>& n2) {
vector<int> result;
sort(n1.begin(), n1.end());
sort(n2.begin(), n2.end());
int i = 0, j = 0;
@s4553711
s4553711 / 83.cpp
Created March 31, 2017 17:44
leetcode 83. pay attention to the second while loop which could be result in null ListNode struct so NULL check is required.
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
@s4553711
s4553711 / 21.cpp
Created April 1, 2017 16:22
leetcode-21. Pay attention to the h and t linked list pointer
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
@s4553711
s4553711 / 148.cpp
Created April 2, 2017 09:13
recursive mergesort
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public: