Skip to content

Instantly share code, notes, and snippets.

@aoshiman
aoshiman / logger.py
Created May 10, 2016 03:40
dacorator
# -*- coding: utf-8 -*-
from datetime import datetime
from functools import wraps
def logging(func):
"""A decorator that logs the activity of the script."""
@wraps(func)
def wrapper(obj, *args, **kwargs):
print("{0:%Y-%m-%d %H:%M:%S} {1} {2} {3} args={4} kwargs={5}"\
@hiromasaono
hiromasaono / MakingDockerContainerForBiologist.md
Last active May 30, 2019 14:53
MakingDockerContainerForBiologist

Dockerコンテナをつくる on MacOSX

bioな分野でDockerを使うとなにがいいのか

  • コンピュータによるデータ解析をだれでもどこでもコマンド一発で再現できるのが素敵
    • エヴァンジェリスト@iNut氏談
  • バイオインフォマティクスの参入障壁の一つであるマシン環境設定も考慮しなくていい
  • いままで環境構築に時間を費やしがちだった講習会などでも便利そう
@drorata
drorata / gist:146ce50807d16fd4a6aa
Last active February 27, 2024 10:15
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})

Wikipediaデータダウンロード先

http://dumps.wikimedia.org/jawiki/latest/

ダウンロード&解凍

# wget http://dumps.wikimedia.org/jawiki/latest/jawiki-latest-pages-articles-multistream.xml.bz2
# bunzip2 jawiki-lasest-pages-articles.xml.bz2
@goldsmith
goldsmith / numpy_os_x_10_9.sh
Last active January 6, 2024 07:25
How to install Numpy and Scipy on Mac OS X Mavericks (10.9) using Pip.
# set up flags for Numpy C extentions compiling
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch x86_64"
export CC=gcc-4.2
export CXX="g++ -arch i386 -arch x86_64"
pip install numpy
# success!
@maddievision
maddievision / TweetBot.py
Created March 4, 2013 03:41
Very simple wrapper for TweetBot URL scheme for Pythonista http://omz-software.com/pythonista
import urllib
import webbrowser
CALLBACK_URL_BASE = 'pythonista://'
url = "tweetbot://x-callback-url/post?"
def tweet(txt,cb=CALLBACK_URL_BASE):
data = {
'text': txt,
'callback_url': cb
}
@acwright
acwright / gist:1163883
Created August 22, 2011 23:10
Cocoa Menu Item Title Toggle
# pragma mark menu
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
if ([menuItem action] == @selector(toggleRuler:)) {
if ([canvasView rulersVisible]) {
[menuItem setTitle:@"Hide Ruler"];
} else {
[menuItem setTitle:@"Show Ruler"];
}
}