Skip to content

Instantly share code, notes, and snippets.

@drillbits
drillbits / download.py
Last active February 24, 2017 06:02
download slack emoji
#!/usr/bin/env python3.6
from datetime import datetime
import json
import os
import sys
import urllib.request
if len(sys.argv) < 2:
print(f"usage: {sys.argv[0]} filelist.json")

Keybase proof

I hereby claim:

  • I am drillbits on github.
  • I am drillbits (https://keybase.io/drillbits) on keybase.
  • I have a public key whose fingerprint is B5A0 EAD5 AB42 780A A6A8 D066 AF1D 2B41 AAC2 38CF

To claim this, I am signing this object:

@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 / 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
@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 / 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 / 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 / forms.py
Last active August 28, 2018 11:09
How to test django.forms.ImageField
from django import forms
class PhotoForm(forms.Form):
image = forms.ImageField()
@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 / 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.