Skip to content

Instantly share code, notes, and snippets.

@tsuyukimakoto
tsuyukimakoto / read_exif_data.swift
Created August 9, 2014 09:57
Read exif data from raw file.
import Foundation
import Cocoa
for arg in Process.arguments[1...Process.arguments.count - 1] {
let cgDataRef = CGImageSourceCreateWithURL(NSURL.URLWithString("file://\(arg)"), nil).takeUnretainedValue()
let imageDict:CFDictionaryRef = CGImageSourceCopyPropertiesAtIndex(cgDataRef, 0, nil).takeUnretainedValue()
println(imageDict)
}
@tsuyukimakoto
tsuyukimakoto / raw_to_tiff.swift
Created August 9, 2014 10:13
Convert raw, or any image, to tiff format image file.
import Foundation
import Cocoa
for arg in Process.arguments[1...Process.arguments.count - 1] {
let fpath = arg.stringByExpandingTildeInPath
let outpath = fpath.stringByDeletingPathExtension + ".tiff"
let im:NSImage = NSImage(contentsOfFile: fpath)
let imageData = im.TIFFRepresentation
@tsuyukimakoto
tsuyukimakoto / tree.swift
Created August 9, 2014 15:19
tree (print file list recursively)
import Foundation
import Cocoa
var fm = NSFileManager()
var err:NSError?
var err2:NSError?
var indent_cnt = 0
func indent(depth:Int) -> String {
@tsuyukimakoto
tsuyukimakoto / embed_db.md
Last active August 29, 2015 14:05
組み込みDB調査 2014/08

Apertureの訃報の噂で哀しみつつ、未来を模索してる。

LR5は正しい解だけど。

NIKONの Capture NX-D の正式版配布が7月に始まったのでrawの現像は純正アプリでやれば良く、その後のレタッチは onOne Software のPerfect Photo Suiteを使うので、写真の管理だけできれば良いのです。

http://imaging.nikon.com/lineup/microsite/capturenxd/jp/

今の構成は母艦のiMac (2009 Early!)にメタデータのインデックスファイル、写真のデータは外付けのUSB-HDDに置いている。

//
// main.swift
// plain_directory
//
// Created by makoto tsuyuki on 2014/08/23.
// Copyright (c) 2014年 makoto tsuyuki. All rights reserved.
//
import Foundation
import Cocoa
@tsuyukimakoto
tsuyukimakoto / screenshot.sh
Created November 29, 2014 17:25
take screenshots forever.
#!/bin/sh
# sec before start taking screenshot.
wait=5
# screenshot interval
interval=30
# output directory
outputdir=$HOME'/Desktop/ss/'`date +%Y-%m-%d`_`date +%H.%M.%S`
echo 'Interval:' $interval 'sec'
@tsuyukimakoto
tsuyukimakoto / gist:675650936f59a2306133
Created July 4, 2015 07:58
Set selected wtforms.ext.sqlalchemy.fields.QuerySelectField.
diff --git a/wtforms/ext/sqlalchemy/fields.py b/wtforms/ext/sqlalchemy/fields.py
index 286dada..6c1a40e 100644
--- a/wtforms/ext/sqlalchemy/fields.py
+++ b/wtforms/ext/sqlalchemy/fields.py
@@ -56,9 +56,10 @@ class QuerySelectField(SelectFieldBase):
def __init__(self, label=None, validators=None, query_factory=None,
get_pk=None, get_label=None, allow_blank=False,
- blank_text='', **kwargs):
+ blank_text='', coerce=None, **kwargs):
$ mkdir -p ~/venv
$ pyvenv ~/venv/ivk
$ source ~/venv/ivk/bin/activate
$ cd ~/venv/ivk
$ curl -O https://raw.githubusercontent.com/pyinvoke/invoke/master/completion/zsh
$ source ~/venv/ivk/zsh
$ pip install --upgrade pip
$ pip install invoke
@tsuyukimakoto
tsuyukimakoto / mapreduce_logparser.py
Created February 13, 2016 06:40
忘れないようにメモだけ
import os
import re
from datetime import datetime, timedelta
from optparse import OptionParser
import operator
import collections
import itertools
import multiprocessing
@tsuyukimakoto
tsuyukimakoto / front20170212.md
Created February 12, 2017 12:50
react / redux 2017.02.12

react

redux

reduxのmiddleware

redux-thunk vs redux-promise vs redux-sage

redux-saga良さそう