Skip to content

Instantly share code, notes, and snippets.

View hagino3000's full-sized avatar

Takashi Nishibayashi hagino3000

View GitHub Profile
@hagino3000
hagino3000 / plot_retention_sample.py
Created August 16, 2014 19:33
リテンション率のグラフをmatplotlibで描画する
import numpy as np
import matplotlib.pyplot as plt
# それっぽいデータを作る処理
from datetime import datetime, timedelta
import scipy
import scipy.stats
def create_dummy_data(days):
x = np.linspace(2, 2 + days, days)
y = scipy.stats.norm.pdf(x, loc=0, scale=4) * 4 + 0.15
@hagino3000
hagino3000 / get_screen_capture.sh
Created July 13, 2014 12:07
荒川智則個展運用
#!/opt/local/bin/zsh
IMG_FILENAME=`date +'%Y-%m-%d %H:%M'`.png
/usr/sbin/screencapture -x ~/tmp/capture/$IMG_FILENAME
@hagino3000
hagino3000 / example.js
Last active August 29, 2015 14:02
画像の真ん中をいい感じに切り取るスクリプト
define(['utils', 'template'], function (Utils, JST) {
'use strict';
function render() {
// テンプレート使ってレンダリングする例
$('#target').html(JST['app/templates/fuga.ejs'], {images: [],....});
// 画像を60px * 60pxの枠に納めるとする
var adjustFn = Utils.createImageAdjustFn(60, 60);
$('#target .profile img').on('load', function() {
# -*- coding: utf-8 -*-
import argparse
import json
import urllib
parser = argparse.ArgumentParser(description="Fetch Youtube movie info by movie id",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog='Ex: python fetch_ytmovie.py rMHdqOyp6tc'
)
import socket
import time
import threading
def server():
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind(('localhost', 9999))
server_socket.listen(1)
@hagino3000
hagino3000 / zmq.test.py
Created March 5, 2014 01:13
ZeroMQ PUSH-PULL Connection test
# -*- coding: utf-8 -*-
import time
import threading
import zmq
def server():
print('Start server')

S3 と非同期サムネイル作成 コトハジメ

更新

2013-11-05

バージョン

0.1.7

作者

@voluntas

URL

http://voluntas.github.io/

概要

@hagino3000
hagino3000 / touch_delay_test.html
Created December 6, 2013 02:15
Check click event delay of device browser
<!doctype html>
<html>
<head>
<title>Touch Event Test</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />
<style>
html {
height: 100%;
}
body {
@hagino3000
hagino3000 / .vimrc
Last active December 20, 2016 04:31
watchmedo(watchdog)を使ってエディタでファイルを保存する度にテストを実行する時の設定 ref: http://qiita.com/hagino3000/items/916bf61a0639b46ccffd
let OSTYPE = system('uname')
if OSTYPE == "Darwin\n"
set noswapfile
set nowritebackup
endif
# -*- coding: utf-8 -*-
import boto.sns
AWS_ACCESS_KEY = 'xxxx'
AWS_SECRET_ACCESS_KEY = 'yyyyyyyy'
APPLICATION_ARN = 'arn:aws:sns:ap-northeast-1:0000:app/APNS_SANDBOX/aaaa'
# SNSに接続
sns_connection = boto.sns.connect_to_region('ap-northeast-1',