Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
csvから文字列を探して位置を返す
# 入力形式. csvが渡されることを想定
"Z","T","A","V",
"P","G","P","N",
# 出力形式
@mogi
mogi / dateutil.py
Created October 28, 2014 03:04
dateutil.parser.parseの使いかた
>>> import dateutil.parser
>>> print dateutil.parser.parse('Oct 3 12:00:00')
2014-10-03 12:00:00
>>> type(dateutil.parser.parse('Oct 3 12:00:00'))
<type 'datetime.datetime'>
@mogi
mogi / make_ctags.sh
Created January 16, 2015 08:47
git-hook make crags
#!/bin/sh
ctags -R
@mogi
mogi / test.html
Last active August 29, 2015 14:16
hogan.js test
<!DOCTYPE html>
<html>
<head>
<script src="http://www.google.com/jsapi"></script>
<script>google.load('jquery', 1);</script>
<script src="http://twitter.github.com/hogan.js/builds/2.0.0/hogan-2.0.0.js"></script>
<script>
$(function() {
function callAPI (method, url, async){
#!/usr/bin/python
#
# Get uuid by blkid output.
# :param blkid: str
# :param target: str
# :rtype :str
#
import json
import sys
import shlex
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import shlex
from ansible.module_utils.basic import *
DOCUMENTATION = '''
---
*.bin
*.swp
*.bak
*.old
*.egg
*.egg-info
*.crt
*.key
*.pem
*.pub
public function setPhoto()
{
$options = array(
'file_src' => '',
'is_image' => true,
'with_delete' => false,
'template' => get_partial('default/formEditImage', array('image' => $this->getObject())),
);
$this->setWidget('photo', new sfWidgetFormInputFileEditable($options, array('size' => 40)));
$this->setValidator('photo', new opValidatorImageFile(array('required' => false)));
# -*- coding: utf-8 -*-
class Hoge(object):
def foo(self, num):
"""
0~num-1までの数字をリスト形式で作成する
>>> a = Hoge()
>>> a.foo(5)
[0, 1, 2, 3, 4]
"""
return [e for e in range(num)]
@mogi
mogi / myprofiler.py
Created August 19, 2012 14:55 — forked from methane/myprofiler.py
Casual MySQL profiler using "SHOW FULL PROCESSLIST"
#!/usr/bin/env python
# coding: utf-8
"""myprofiler - Casual MySQL Profiler
https://github.com/methane/myprofiler
"""
import os
import sys