Skip to content

Instantly share code, notes, and snippets.

View LiorZ's full-sized avatar

LiorZ LiorZ

View GitHub Profile
@yasaichi
yasaichi / x_means.py
Last active May 1, 2025 11:26
Implementation of X-means clustering in Python
"""
以下の論文で提案された改良x-means法の実装
クラスター数を自動決定するk-meansアルゴリズムの拡張について
http://www.rd.dnc.ac.jp/~tunenori/doc/xmeans_euc.pdf
"""
import numpy as np
from scipy import stats
from sklearn.cluster import KMeans
@mabdrabo
mabdrabo / sound_recorder.py
Created January 28, 2014 23:05
Simple script to record sound from the microphone, dependencies: easy_install pyaudio
import pyaudio
import wave
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "file.wav"
@dmachi
dmachi / apt.py
Created June 1, 2012 17:34
Gluster Plugin for StarCluster
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class addRepository(ClusterSetup):
def __init__(self, repositories=None):
self.repositories=repositories
if self.repositories:
self.repositories= [repo.strip() for repo in repositories.split(',')]
@chapmanb
chapmanb / gist:727625
Created December 3, 2010 21:57
retrieve_gene.py
from Bio import Entrez
def fetch_gene_coordinates(search_term):
handle = Entrez.esearch(db="gene", term=search_term)
rec = Entrez.read(handle)
gene_id = rec["IdList"][0] # assuming best match works
handle = Entrez.efetch(db="gene", id=gene_id, retmode="xml")
rec = Entrez.read(handle)[0]
gene_locus = rec["Entrezgene_locus"][0]