Skip to content

Instantly share code, notes, and snippets.

View kojix2's full-sized avatar
🔬
🧬 🖥️ ♋

kojix2

🔬
🧬 🖥️ ♋
View GitHub Profile
# It is show-the-point demo for my article
# "On DataFrame datatype in Ruby" http://zverok.github.io/blog/2016-01-10-dataframe.html
require 'good_data_frame' # `require': cannot load such file -- good_data_frame (LoadError)
# Initialization (with default index): hashes of column: values
# Values of each column are homogenous
# First and most important thing is "what columns is"
table = GDF.new(
manager: ['Tom', 'Jerry', 'Magda'],
@parmentf
parmentf / GitCommitEmoji.md
Last active April 29, 2025 11:20
Git Commit message Emoji
@PoisonAlien
PoisonAlien / readBam.C
Last active November 9, 2023 21:21
reading bam files in C using htslib
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <htslib/sam.h>
int main(int argc, char *argv[]){
samFile *fp_in = hts_open(argv[1],"r"); //open bam file
bam_hdr_t *bamHdr = sam_hdr_read(fp_in); //read header
bam1_t *aln = bam_init1(); //initialize an alignment
@yugui
yugui / extension.ja.rdoc
Last active September 19, 2024 05:47
extension.ja.rdoc -- extension library

CのデータをRubyオブジェクトにする

Cの世界で定義されたデータ(構造体)をRubyのオブジェクトとして取り扱いたい場合がありえます.このような場合はTypedData_XXX マクロ群を用いて構造体へのポインタとRubyのオブジェクトとを互いに変換できます.

# 古い(非Typedな)Data_XXXマクロ群は非推奨になりました.

# 将来のバージョンのRubyでは古いマクロは動作しなくなる可能性があります.

@junpeitsuji
junpeitsuji / binom.rb
Last active March 6, 2020 00:30
binom.rb - 二項係数を3パターンで実行するスクリプト
require 'benchmark'
_MAXNUM=1000
#=begin
# 二項係数 nCk を計算する関数 ver.1
def binom_v1(n,k)
if k==0 then
return 1
@DQNEO
DQNEO / convert_annotate.sh
Created March 26, 2014 09:39
[ImageMagick]convertコマンドで写真に文字を入れる
$ convert -pointsize 300 -gravity south -font Times-Roman -annotate 0 "aaaaa" -fill red flower.jpg out.jpg
# -pointsize 文字の大きさ
# -gravity 文字の位置
# -font フォント
# -annotate 数値:文字の傾き 文字列:テキスト
# -fill 文字の色
@vincentchu
vincentchu / smith-waterman.rb
Created June 23, 2011 05:50
Smith Waterman implementation in Ruby
class Matrix
IndexOverflow = Class.new(StandardError)
attr_reader :dims, :nrows, :ncols
def initialize(mm, nn)
@dims = [mm, nn]
@nrows = mm
@ncols = nn