Skip to content

Instantly share code, notes, and snippets.

View Surgo's full-sized avatar
🛰️
Generating...

Kosei Kitahara Surgo

🛰️
Generating...
View GitHub Profile
@frsyuki
frsyuki / mysql-usec.md
Last active October 8, 2020 01:02
Getting current time in microseconds in MySQL < 5.6

MySQL 5.5 で現在時刻をマイクロ秒の精度で取得する方法

画期的な方法を発見した。MySQL 5.5 の UUID() 関数は、100ナノ秒精度の現在時刻を含んだ UUID v1 を返す(12.15. Miscellaneous Functions)。これをパースすればマイクロ秒精度の現在時刻を取得することができる。

詳しい実装についてはmysqldのソースに書いてあるので読めばいい。mysql-5.5.27/sql/item_strfunc.cc に実装してある。141427日間のオフセットがかかっていたりするので気をつける。

DELIMITER //
CREATE FUNCTION TIMESTAMP_USEC()
RETURNS BIGINT NOT DETERMINISTIC
@voluntas
voluntas / shiguredo_env.rst
Last active December 2, 2024 00:23
時雨堂を支える環境

時雨堂を支える環境

日時:2024-12-02
作:時雨堂
バージョン:2024.3
url:https://shiguredo.jp/

2024-12 時点で従業員は全員フルリモート勤務中

@voluntas
voluntas / haystack_es_kuromoji.rst
Last active March 12, 2024 07:08
Haystack + Elasticsearch + kuromoji コトハジメ

Haystack + Elasticsearch + kuromoji コトハジメ

更新:2013-09-28
バージョン:0.0.9
作者:@voluntas
URL:http://voluntas.github.io/

Django + Elasticsearch コトハジメの補足記事です

@voluntas
voluntas / sentry_django.rst
Last active March 26, 2020 01:23
Sentry + Django コトハジメ
@tcnksm
tcnksm / docker_cheat.md
Last active January 14, 2025 15:09 — forked from wsargent/docker_cheat.md
Docker 虎の巻

Docker 虎の巻

何故Dockerを使うべきか

Why Should I Care (For Developers)

"Dockerが面白いのはシンプルな環境に隔離性と再現性をもたらしてくれることだ.ランタイムの環境を一度作れば、パッケージにして別のマシンでも再利用することできる.さらに,すべてはホスト内の隔離された環境で行われる(VMのように).最も素晴らしい点は,シンプルかつ高速であることだ."

@diyan
diyan / python_stack.md
Last active September 3, 2020 10:32
Tools and libraries which I prefer to use in Python stack

Tools and libraries which I prefer to use in Python stack

Development Environment

  • Ubuntu Linux for both development and production
  • Git version control system
  • Jenkins CI build server (but recently I'm moving to git server-side hooks with ssh from git server to dev/stage/prod servers)
  • Redmine bug tracking system
  • JetBrains PyCharm IDE

Production Environment

@reclosedev
reclosedev / celery_sentinel.py
Last active April 24, 2019 00:01
Temporary hack. Redis Sentinel support for Celery.
"""
This module adds Redis Sentinel transport support to Celery.
Current version of celery doesn't support Redis sentinel client, which is must have for automatic failover.
To use it::
import register_celery_alias
register_celery_alias("redis-sentinel")
celery = Celery(..., broker="redis-sentinel://...", backend="redis-sentinel://...")
@rokujyouhitoma
rokujyouhitoma / gist:173b75f030a1f1f22591
Created September 19, 2014 04:40
PythonでHTTP RequestとResponseの生文字列を確認したい時のモンキーパッチ
def http_connection_send():
import httplib
def patch_send():
old_send= httplib.HTTPConnection.send
def new_send(self, data, *args, **kwargs):
print(data)
body = old_send(self, data, *args, **kwargs)
return body
httplib.HTTPConnection.send = new_send
patch_send()