Skip to content

Instantly share code, notes, and snippets.

View ariela's full-sized avatar

Takeshi Kawamoto ariela

View GitHub Profile
@ariela
ariela / SiteBuilder.php.diff
Created January 23, 2020 07:07
Jigsaw の beforeBuild で作成したファイルが消えるのに対応
--- SiteBuilder.php 2020-01-23 16:06:06.000000000 +0900
+++ SiteBuilder.1.php 2020-01-23 16:06:03.000000000 +0900
@@ -33,8 +33,8 @@
public function build($source, $destination, $siteData)
{
$this->prepareDirectory($this->cachePath, ! $this->useCache);
- $generatedFiles = $this->generateFiles($source, $siteData);
$this->prepareDirectory($destination, true);
+ $generatedFiles = $this->generateFiles($source, $siteData);
$outputFiles = $this->writeFiles($generatedFiles, $destination);
@ariela
ariela / helix-case.scad
Created December 10, 2018 13:34
出力試していないけど、練習用にHelixケースのスイッチ側書いてみた
$fs = 0.1;
row_count = 5;
col_count = 7;
hole_width = 14.1;
hole_height = 14.1;
hole_radius = 0.3;
screw_diameter = 2.2;
@ariela
ariela / narou.install.sh
Created August 21, 2018 09:04
narou+rbenv+bundler
sudo yum -y install git
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo '# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"' | tee -a ~/.bash_profile
exec $SHELL --login
sudo yum -y install unzip bzip2 gcc openssl-devel readline-devel zlib-devel java-1.8.0-openjdk
@ariela
ariela / install.sh
Created February 14, 2018 07:41
rpi0w mass storage
#!/bin/sh
BLOCK_SIZE=4096
TARGET_SIZE=16
GiB_SIZE=1073741824
MOUNT_PATH=/storage
STORAGE_PATH=/usbstorage.bin
STORAGE_SIZE=$((${TARGET_SIZE} * ${GiB_SIZE}))
COUNT_SIZE=$((${STORAGE_SIZE}/${BLOCK_SIZE}))
@ariela
ariela / main.go
Created July 30, 2014 05:14
画像から彩度の標準偏差を取得し、閾値より大きい場合にカラー画像とする。opencvとcgoで処理。
package main
//#cgo pkg-config: opencv
//#include <cv.h>
//#include <highgui.h>
import "C"
import (
"os"
"flag"
@ariela
ariela / curry.java
Created April 24, 2014 01:43
Java8でカリー化の実験
package curry;
import java.util.function.Function;
interface F<T, R> extends Function<T, R> {}
public class Curry {
public static void main(String[] args) {
F<Integer, F<Integer, Integer>> compare = max -> x -> (max <= x) ? max : x;
@ariela
ariela / curry.php
Created April 23, 2014 08:59
PHPでカリー化の実験
<?php
/**
* 指定値を最大値として、入力された値が最大値以上の場合は
* 最大値として扱うカリー化関数
* @param integer $max 最大値
* @return Closure 比較関数 f(x)
*/
function compare($max) {
return function ($x) use ($max) {
return ($x < $max) ? $x : $max;
@ariela
ariela / autorun.sh
Created August 7, 2013 06:25
PQI Air CardをWiFi子機にする。(im.kayacを使用) 流用元:革命的使用感!デジカメをPQI Air CardでiPhone 5のテザリング子機にするとすごく便利! http://hitoriblog.com/?p=14505
#!/bin/sh
# 通知先URL
imkayac='http://im.kayac.com/api/post/<USERNAME>'
# パスワード
passwd='<PASSWORD>'
# もしうまくテザリングできなかったらsleepの数字を増やす
sleep 5
@ariela
ariela / neta.php
Created July 12, 2013 12:46
ネタ
<?php
$d = new stdClass();
$d->a = 'a';
$d->b = 'b';
$a = new ArrayWapper(range(1,9));
$a->map(function($a) { return $a * 10; });
$s = 0;
@ariela
ariela / grunt.js
Created September 6, 2012 10:33
gruntの設定
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
coffee: {
dist: {
src: ['assets/coffee/**/*.coffee'],
dest: 'assets/js/wcv-main.js'
}
},