Skip to content

Instantly share code, notes, and snippets.

View tag1216's full-sized avatar
😇

tag1216 tag1216

😇
View GitHub Profile
@tag1216
tag1216 / deleted_calendar.py
Last active January 12, 2017 12:12
Qiita Advent Calendar 2016 で削除されたカレンダー
import re
import requests
import time
def main():
url = "http://qiita.com/sudoyu/items/0a51593b257f419aeb20.md"
print(url)
@tag1216
tag1216 / docker-compose.yml
Created January 23, 2017 07:24
DjangoをDocker Composeで動かすときにDBが起動するまで待つ
command: ["./wait-for-db.sh", "--", "python", "manage.py", "runserver", "0.0.0.0:8000"]
@tag1216
tag1216 / Dockerfile
Created February 10, 2017 01:29
NEologdコンテナのDockerfile
#https://github.com/neologd/mecab-ipadic-neologd/blob/master/README.ja.md
FROM ubuntu
RUN apt update
RUN apt -y upgrade
RUN apt -y install mecab libmecab-dev mecab-ipadic-utf8 git make curl xz-utils file
# install neologd
RUN mkdir -p /usr/lib/mecab/dic
RUN cd /root; \
@tag1216
tag1216 / 01_thread.py
Created April 2, 2017 12:19
Pythonでconcurrent.futuresを使った並列タスク実行
import time
from concurrent.futures import ThreadPoolExecutor
from logging import StreamHandler, Formatter, INFO, getLogger
def init_logger():
handler = StreamHandler()
handler.setLevel(INFO)
handler.setFormatter(Formatter("[%(asctime)s] [%(threadName)s] %(message)s"))
logger = getLogger()
@tag1216
tag1216 / largesort.py
Created May 7, 2017 07:45
巨大ファイルのソート
import heapq
import os
import re
from argparse import ArgumentParser
from contextlib import contextmanager
from operator import itemgetter
from tempfile import TemporaryDirectory, mktemp
import sys
from typing import IO, Callable, List
@tag1216
tag1216 / README.md
Last active May 10, 2017 07:53
バッチスクリプトの進捗をコンソールに出力する方法

progress

mkdir -p mnt
sshfs host:/path/to/dir mnt
fusermount -u mnt
@tag1216
tag1216 / dynamic_import.py
Created July 14, 2017 12:55
ディレクトリ内のPythonファイルを動的インポート
import os
import sys
from glob import glob
from importlib import import_module
sys.path.append('plugins')
for path in glob('plugins/*.py'):
filename = os.path.basename(path)
print(filename)
@tag1216
tag1216 / plugin_manager.py
Created July 14, 2017 14:27
ディレクトリ内のPythonモジュールを動的インポート/リロード
import os
import sys
import time
from glob import glob
from importlib import import_module, reload
from watchdog.events import FileSystemEventHandler, FileSystemEvent
from watchdog.observers import Observer
sys.path.append('plugins')
@tag1216
tag1216 / deployment.cmd
Created August 12, 2017 03:49
Azure deployment.cmd
@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------
:: Prerequisites
:: -------------