This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
import logging | |
import re | |
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.DEBUG) | |
ch = logging.StreamHandler() | |
ch.setLevel(logging.DEBUG) | |
logger.addHandler(ch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'aws/aws-autoloader.php'; | |
class LogReport { | |
const LOG_GROUP_NAME = 'LOG_GROUP_NAME'; | |
const FILTER_PATTERN = '[ip, dummy1, uid, timestamp, request, status_code = 4*, bytes, referer, user_agent]'; | |
const PATH_PATTERN = '/"(?:GET|POST|HEAD) ([^ ]+) [^ ]+" \d{3}/'; | |
const AWS_PROFILE = 'dummy_account'; | |
const AWS_VERSION = 'latest'; | |
const AWS_REGION = 'ap-northeast-1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
$.fn.disableOutboundLinks = function(config) { | |
var defaults = $.extend({ | |
ignoringDirs: "" // 無効化にしないディレクトリを「,」区切りで定義します。 | |
// 例)ignoringDirs: "foo, bar/baz" | |
}); | |
var options = $.extend(defaults, config); | |
/** | |
* カンマ区切りのディレクトリ名を、正規表現のパターンに変換します。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://github.com/ChristianRiesen/base32 を利用しました。 | |
require_once 'Base32.php'; | |
use Base32\Base32; | |
class Totp { | |
/** | |
* コンストラクタ | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import sys | |
import argparse | |
def sample1(): | |
""" | |
ハイフンがある引数を取る場合 | |
引数の例) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import abc | |
class NoAbstractBase(object): | |
def method1(self): | |
pass | |
def method2(self): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from contextlib import contextmanager | |
from datetime import datetime | |
from sqlalchemy import ( | |
create_engine, Column, ForeignKey, Integer, Float, String, | |
Date, DateTime | |
) | |
from sqlalchemy.ext.declarative import declarative_base, declared_attr | |
from sqlalchemy.orm import sessionmaker, reconstructor, relationship |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
class BaseModelMixin(object): | |
def save(self, exclude_fields=None, *args, **kwds): | |
if not exclude_fields: | |
# exclude_fieldsがない場合は、親のsaveメソッドをそのまま呼んで返します。 | |
return super().save(*args, **kwds) | |
if 'update_fields' in kwds: | |
raise Exception('exclude_fieldsはupdate_fieldsと同時に指定することはできません。') |