Skip to content

Instantly share code, notes, and snippets.

View craftzdog's full-sized avatar
🏠
Working from home

Takuya Matsuyama craftzdog

🏠
Working from home
View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
@craftzdog
craftzdog / phantomjs-shims.js
Created December 20, 2014 01:05
PhantomJS shims for supporting HTML5
module.exports = function() {
var Ap = Array.prototype;
var slice = Ap.slice;
var Fp = Function.prototype;
if (!Fp.bind) {
// PhantomJS doesn't support Function.prototype.bind natively, so
// polyfill it whenever this module is required.
Fp.bind = function(context) {
@craftzdog
craftzdog / userContent.css
Created January 6, 2015 10:43
Stylesheet for plain text e-mail on Thunderbird
/* Save it to ~/Library/Thunderbird/Profiles/*.default/chrome/userContent.css */
span[_moz_quote=true] {
color: orange !important;
}
pre[_moz_quote=true] {
color: orange !important;
}
blockquote[type=cite] {
color: orange !important;
import caffe
import numpy as np
import sys
if len(sys.argv) != 3:
print "Usage: python convert_protomean.py proto.mean out.npy"
sys.exit()
blob = caffe.proto.caffe_pb2.BlobProto()
data = open( sys.argv[1] , 'rb' ).read()
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys, numpy
categories = numpy.loadtxt(sys.argv[1], str, delimiter="\t")
scores = numpy.load(sys.argv[2])
top_k = 10
prediction = zip(scores[0].tolist(), categories)
prediction.sort(cmp=lambda x, y: cmp(x[0], y[0]), reverse=True)
for rank, (score, name) in enumerate(prediction[:top_k], start=1):
@craftzdog
craftzdog / UIImage+Retina4.h
Created September 25, 2012 20:41 — forked from sserye/UIImage+Retina4.h
Swizzled UIImage imageNamed for iPhone 5
//
// UIImage+Retina4.h
// StunOMatic
//
// Created by Benjamin Stahlhood on 9/12/12.
// Updated by noradaiko on 9/26/12.
// Copyright (c) 2012 DS Media Labs. All rights reserved.
// Copyright (c) 2012 noradaiko. All rights reserved.
//
@craftzdog
craftzdog / gist:4073071
Created November 14, 2012 16:19
my tmux conf
unbind C-b
set-option -g prefix C-t
#bind t send-key C-t
# basic settings
#set-option utf8-default on
#set-option -g mouse-select-pane
set-window-option -g mode-keys vi
#set-window-option -g utf8 on
# look'n feel
set-option -g status-fg cyan
module CookbookLogrotate
DIRECTIVES = %w[
compress copy copytruncate daily dateext
delaycompress ifempty mailfirst maillast missingok
monthly nocompress nocopy nocopytruncate nocreate
nodelaycompress nodateext nomail nomissingok noolddir
nosharedscripts noshred notifempty sharedscripts shred
weekly yearly
]
@craftzdog
craftzdog / check_all_iostat
Created April 28, 2013 06:44
This is a nagios plugin for monitoring all disk I/O stats.
#!/bin/bash
#
# Version 0.0.3 - Apr/2013
# Changes: summerize all disk I/O
#
# Version 0.0.2 - Jan/2009
# Changes: added device verification
#
# by Takuya Matsuyama - nora@odoruinu.net
# by Thiago Varela - thiago@iplenix.com
@craftzdog
craftzdog / ExtensionLoader.js(169)
Created December 18, 2015 02:11
brackets/atomのエクステンションの仕組み ref: http://qiita.com/noradaiko/items/a35d2b8191765a4e84e5
// Read optional requirejs-config.json
var promise = _mergeConfig(extensionConfig).then(function (mergedConfig) {
// Create new RequireJS context and load extension entry point
var extensionRequire = brackets.libRequire.config(mergedConfig),
extensionRequireDeferred = new $.Deferred();
contexts[name] = extensionRequire;
extensionRequire([entryPoint], extensionRequireDeferred.resolve, extensionRequireDeferred.reject);
return extensionRequireDeferred.promise();