Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
filenum = sys.argv[1]
afile = open('femo-%s.txt' % (filenum)).read().splitlines()
memo = []
directory = 'memo%s' % (filenum)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import commands
import os
import re
import sys
dirnum= sys.argv[1]
os.chdir('memo%s' % (dirnum))
@yono
yono / gist:670459
Created November 10, 2010 06:40
MBP 構成
製品名: MacBook Pro 13インチ
オプション:
2.4GHz Intel Core 2 Duo
4GB 1066MHz DDR3 SDRAM - 2x2GB
250GB Serial ATA Drive @ 5400 rpm
SuperDrive 8x (DVD±R DL/DVD±RW/CD-RW)
バックライトキーボード (US) + 製品マニュアル
アクセサリキット
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import commands
files = commands.getoutput('ls -1 *.mp4').splitlines()
for afile in files:
print afile
chapter = afile.replace('.mp4','') + '_chapters.xml'
print chapter
@yono
yono / form-hint.html
Created February 26, 2011 04:12
空の入力フォームにヒントメッセージを表示する JavaScript
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
<!--
$(function(){
$("input.input-hint").fillHint();
});
@yono
yono / gist:1047706
Created June 26, 2011 15:26
redmine ユーザマスタで苗字と名前カラムを入れ替える(要 jQuery)
var hoge = $('.list').children('thead').find('th')[1];
$(hoge).insertAfter($('.list').children('thead').find('th')[2]);
$.each($('tr.user'), function(){
$($(this).find('td')[1]).insertAfter($(this).find('td')[2])
});
@yono
yono / gist:1056639
Created June 30, 2011 16:47
redmine の「作業時間を記録」のカスタムフィールドの値を集計する
SELECT
max(users.lastname) || max(users.firstname) as name, sum(to_number(value, '0000000000000')),
max(custom_fields.name) as custom_field_name
FROM time_entries
INNER JOIN (SELECT * FROM custom_values WHERE customized_type = 'TimeEntry') custom_values
ON time_entries.id = customized_id
INNER JOIN custom_fields
ON custom_fields.id = custom_values.custom_field_id
INNER JOIN users
ON users.id = time_entries.user_id
--- a/src/youtube_video_url.cc 2011-08-09 21:33:43.000000000 +0900
+++ b/src/youtube_video_url.cc 2011-08-09 21:32:44.000000000 +0900
@@ -47,7 +47,7 @@
#define YOUTUBE_URL_PARAMS_REGEXP "var swfHTML.*\\;"
#define YOUTUBE_URL_LOCATION_REGEXP "\nLocation: (http://[^\n]+)\n"
#define YOUTUBE_URL_WATCH "http://www.youtube.com/watch?v="
-#define YOUTUBE_URL_GET "http://www.youtube.com/get_video?"
+#define YOUTUBE_URL_GET "http://www.youtube.com/get_video?asv=3&"
#define YOUTUBE_URL_PARAM_VIDEO_ID "video_id"
#define YOUTUBE_URL_PARAM_T_REGEXP ".*&t=([^&]+)&"
@yono
yono / evnt2org.py
Created November 18, 2011 16:00
Evernote から Export した HTML を Org-mode 形式に変換するスクリプト
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
evnt2org
convert html text that is exported from Evernote to org-mode
"""
import urllib
require 'open-uri'
require 'uri'
require 'rss'
def rss_url(fqdn, job_name, kind)
File.join(fqdn, 'job', job_name, kind)
end
def latest_title(rss_url)
rss = open(rss_url){ |file| RSS::Parser.parse(file.read) }