Skip to content

Instantly share code, notes, and snippets.

@drillbits
drillbits / encode
Last active August 29, 2015 14:09
encode ts
ffmpeg -y -i in.ts \
-f mp4 -vcodec libx264 \
-fpre libx264.ffpreset \
-cmp chroma -r 30000/1001 \
-aspect 16:9 -s 1440x1080 \
-bufsize 20000k \
-maxrate 25000k -vsync 1 \
-acodec libfaac -ac 2 \
-ar 48000 -ab 128k \
-map 0:0 -map 0:1 out.mp4
@drillbits
drillbits / gist:3180273
Created July 26, 2012 04:36
namedtupleでcsvの各行をリストではなく定義した列名をキーとした辞書として扱う
import csv
import itertools
from collections import namedtuple
# 列名のリスト
fields = ['foo', 'bar', 'baz', 'spam']
Row = namedtuple('Row', ' '.join(fields))
def reader(fp):
/* http://www.csspop.com/clip/show/553 */
.featureBanner {
position:relative;
margin:20px
}
.featureBanner:before {
content: "Featured";
position:absolute;
top:5px;
left:-8px;
setInterval(function(){
var area = document.getElementById('contentArea');
var links = area.getElementsByClassName('uiIconText');
for (var i = 0;i < links.length; i++) {
links[i].click();
}
}, 5000);
@drillbits
drillbits / nTandaX.cob
Created October 31, 2012 12:44
1000反田L on COBOL
000000 IDENTIFICATION DIVISION.
000000 PROGRAM-ID. nTandaX.
000000*
000000 DATA DIVISION.
000000 WORKING-STORAGE SECTION.
000000 01 APB PIC X(26) VALUE 'ABCDEFGHIJKLMNOPORSTUVWXYZ'.
000000 01 I PIC 9(4).
000000 01 G PIC 9(4).
000000 01 N PIC 9(4).
000000 01 X PIC ZZZ9.
@drillbits
drillbits / EntryModel.js
Created January 9, 2013 09:04
Sencha Touch 2 でデータを取得してくるときの proxy とかの使い方
// 適当なモデル
Ext.define('app.model.Entry', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'title', type: 'string'},
{name: 'body', type: 'string'}
]
}
@drillbits
drillbits / tests.py
Created May 11, 2013 06:35
デコレータが邪魔してうまくテストできない例(mock 使えばいけるけど)
# -*- coding: utf-8 -*-
import sys
import unittest
class WorkTest(unittest.TestCase):
def _makeOne(self):
from working import work
return work
@drillbits
drillbits / tests.py
Created May 11, 2013 06:39
venusian 使って、デコレータを定義、スキャン、呼び出しした例
# -*- coding: utf-8 -*-
import sys
import unittest
class WorkTest(unittest.TestCase):
def _makeOne(self):
from working import work
return work
@drillbits
drillbits / conf.json
Last active December 18, 2015 09:49
https://github.com/ymotongpoo/go-twitter 使って手探りで Twitter のメンション取得するの書いてみた。それだけなのもアレなので json から設定取ってくるみたいにした。
{
"Twitter": {
"ConsumerKey": "yourConsumerKey",
"ConsumerSecret": "yourConsumerSecret",
"AccessToken": "yourAccessToken",
"AccessTokenSecret": "yourAccessTokenSecret"
}
}
@drillbits
drillbits / testing.py
Created June 18, 2013 10:26
HttpResponse を返すようなビューで context を検証するやつ
# -*- coding: utf-8 -*-
from copy import copy
from django.test.signals import template_rendered
class AssertHttpResponseContext(object):
def __init__(self, test_case, context_key, context_value):
self.test_case = test_case
self.context_key = context_key