Skip to content

Instantly share code, notes, and snippets.

View smanurung's full-sized avatar
👋

Sonny Theo Tumbur Manurung smanurung

👋
View GitHub Profile
@smanurung
smanurung / palindrome.py
Created September 19, 2019 05:46
Simple palindrome code check
#!/Users/smanurung/miniconda3/bin/python
class Person:
name = "foo"
def sayName(self):
return self.name
def setName(self, n):
self.name = n
@smanurung
smanurung / smith_waterman.py
Created September 9, 2019 04:22 — forked from nornagon/smith_waterman.py
Smith-Waterman Python implementation
import numpy as np
def smith_waterman(a: str, b: str, alignment_score: float = 1, gap_cost: float = 1) -> float:
"""
Compute the Smith-Waterman alignment score for two strings.
See https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm#Algorithm
This implementation has a fixed gap cost (i.e. extending a gap is considered
free). In the terminology of the Wikipedia description, W_k = {c, c, c, ...}.
This implementation also has a fixed alignment score, awarded if the relevant
@smanurung
smanurung / Dockerfile
Created July 31, 2017 06:33
Base docker image including python, conda, and supervisor
FROM python:2.7-slim
WORKDIR /Users/smanurung/Documents/lab/docker/iris-base/
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN yes | apt-get install bzip2
RUN apt-get install -y curl git supervisor
# # install miniconda for python dependency management
RUN curl "https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh" >> /tmp/miniconda.sh
@smanurung
smanurung / topic-generator.pl
Created February 27, 2016 15:40
random topic generator for blogging
#!/usr/bin/perl
my $topicdb = 'topic.txt';
open(my $db, '<', $topicdb) or die $!;
my $count = 0;
my %topic;
while(<$db>){
if($_ =~ "^--"){
@smanurung
smanurung / preprocess.sh
Created February 27, 2016 08:41
static web preprocessor
#!/bin/bash
wd="./src"
t="./template"
o="./output"
fname=$1
ofile=$o/$fname
echo "$ofile"
@smanurung
smanurung / boring.go
Created September 25, 2015 17:57
boring go concurrency pattern
package main
/**
* simple go concurrency pattern
* generator + fanIn
*/
import (
"fmt"
"math/rand"