Skip to content

Instantly share code, notes, and snippets.

View moqada's full-sized avatar

Masahiko Okada moqada

View GitHub Profile
@moqada
moqada / gist:2706723
Created May 16, 2012 02:05
video.js sample for mobile
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<link href="https://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="https://vjs.zencdn.net/c/video.js"></script>
<script>
$(document).ready(function(){
_V_('my_video_1', {}, function(){
var player = this;
if(window.innerWidth < player.width()) {
@moqada
moqada / gist:3665003
Created September 7, 2012 10:36
convert paramstyle format for MySQL to SQLite...
# -*- coding: utf-8 -*-
import re
PYFORMAT_REGEX = re.compile(r'%\((.*?)\)s')
def paramstyle_to_format(sql, params):
u""" paramstyle: pyformat -> format
"""
param_keys = PYFORMAT_REGEX.findall(sql)
@moqada
moqada / gist:3896676
Created October 16, 2012 00:55
dbench for ocha
Operation Count AvgLat MaxLat
----------------------------------------
NTCreateX 500580 0.039 454.574
Close 367734 0.003 27.246
Rename 21196 0.092 35.778
Unlink 101094 0.108 316.059
Deltree 10 3.898 13.595
Mkdir 5 0.004 0.007
Qpathinfo 453742 0.023 41.524
Qfileinfo 79429 0.002 2.688
@moqada
moqada / gist:3896677
Created October 16, 2012 00:56
dbench for sakura
Operation Count AvgLat MaxLat
----------------------------------------
NTCreateX 3237255 0.111 569.945
Close 2378044 0.011 49.704
Rename 137077 0.320 140.372
Unlink 653695 0.371 568.030
Deltree 80 11.905 47.576
Mkdir 40 0.006 0.009
Qpathinfo 2934391 0.062 1749.252
Qfileinfo 514164 0.005 16.372
@moqada
moqada / hooks.py
Created October 24, 2012 06:45
Server for GitLab hooks
# -*- coding: utf-8 -*-
"""
=======================
Server for GitLab hooks
=======================
notifications via email
Usage::
pip install gunicorn
@moqada
moqada / eccube-form.js
Created November 14, 2012 02:43
bookmarklet for eccube
(function() {
var i, payment_id;
if (/^\/shopping\/index\.php/.test(location.pathname)) {
// 非会員選択
if (document.getElementById('member_form2')) {
document.member_form2.submit();
return false;
}
// お届け先入力
document.form1.order_name01.value = '山田';
@moqada
moqada / eccube-form.min.js
Created November 14, 2012 02:45
minified by grunt.js
(function(){var e,t;if(/^\/shopping\/index\.php/.test(location.pathname)){if(document.getElementById("member_form2"))return document.member_form2.submit(),!1;document.form1.order_name01.value="山田",document.form1.order_name02.value="太郎",document.form1.order_kana01.value="ヤマダ",document.form1.order_kana02.value="タロウ",document.form1.order_zip01.value="123",document.form1.order_zip02.value="0000",document.form1.order_pref.value="13",document.form1.order_addr01.value="千代田区神田神保町",document.form1.order_addr02.value="1-3-5",document.form1.order_tel01.value="03",document.form1.order_tel02.value="1234",document.form1.order_tel03.value="5678",document.form1.order_email.value="customer@example.com",document.form1.order_email_check.value="customer@example.com",document.form1.order_sex[0].checked=!0}else if(/^\/shopping\/payment\.php/.test(location.pathname)){t=document.form1.payment_id;if(t.length===undefined&&t.checked)return document.form1.submit(),!1;for(e=0;t.length>e;e++)if(t[e].checked)return document.form1.submit(),!
@moqada
moqada / middleware.py
Created December 19, 2012 02:56
logging POST data for under Django 1.2
# -*- coding: utf-8 -*-
import os
import logging
import logging.handlers
from django.conf import settings
from django.utils import simplejson as json
class POSTScanningMiddleware(object):
@moqada
moqada / gollum.conf
Created January 16, 2013 15:23
nginx config file for gollum
server {
listen 8880;
server_name gollum;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:9090;
access_log /var/log/nginx/gollum.access.log;
@moqada
moqada / node-example.json
Last active December 11, 2015 11:58
setup for coookbook-omnigollum-site
{
"run_list": [
"recipe[htpasswd]",
"recipe[omnigollum_site]"
],
"omnigollum_site": {
"base_path": "/home/gollum/wiki",
"wiki_source": "",
"repository": "git://github.com/moqada/omnigollum-site.git",
"ldap": {