Skip to content

Instantly share code, notes, and snippets.

View sakadon's full-sized avatar
🍀

さかどん sakadon

🍀
View GitHub Profile
@sakadon
sakadon / file0.txt
Last active December 14, 2015 13:11
指定されたディレクトリ内部でgit pullするのをディレクトリ分、繰り返すshell script ref: http://qiita.com/sakadon/items/3aded92edc5867dbb0a5
#!/bin/bash
set -eu
nowdate=`date "+%Y/%m/%d %T"`
host=`hostname -f`
echo -e '!!start git pull carnival!!' | ./slack.sh
find /var/www/html -mindepth 1 -maxdepth 1 -type d | while read FILE
@sakadon
sakadon / file0.txt
Last active November 4, 2015 17:36
Google Spreadsheetsに内容を追記するshell script + Google apps scripts ref: http://qiita.com/sakadon/items/e56856dd7d3c5b93cde1
function doPost(e) {
var ss = SpreadsheetApp.openById("###_API_TOKEN_###");
var sheet = ss.getSheetByName("シート名");
//formデータを取り出して、配列に格納
var array = [e.parameters.timestamp[0],e.parameters.hostname[0],e.parameters.plan[0],e.parameters.uri[0]];
//一発で最終行に書込みする
sheet.appendRow(array);
}
@sakadon
sakadon / gulp.js
Created November 4, 2015 17:59
gulp.js環境で、jadeの中でjsonから定型文を呼び出す、2ヶ国語(ja/en)バージョン ref: http://qiita.com/sakadon/items/692ecb29b24b8db20ef3
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var jade = require('gulp-jade');
var data = require('gulp-data');
// Jade compile to html
gulp.task( 'jade', function() {
gulp.src( './src/jade/*.jade' )
.pipe( data( function (file) {
return { 'meta': require('./src/jade/meta.json')};
@sakadon
sakadon / tpl_mailfromslack.php
Created November 4, 2015 18:21
WordPressを利用してslackからメールを送信する ref: http://qiita.com/sakadon/items/945cfc1f794dd796ad99
<?php
/*
Template Name: mail from slack
これは、WordPressテーマ上で動作させることを前提としていて、
専用に1こ固定ページをつくり、このテンプレートを読み込ませ、
その固定ページのURIでslack apiと連携させ動作させる
あと、tokenは slack api outbound webhooksで設定したのをいれる
送信先アドレスで、headersにいれてあるfromのアドレスを許可するように
↑Google groupsなど
*/
@sakadon
sakadon / manifest.webapp
Last active November 4, 2015 18:37
FirefoxOSアプリでTCP Socket通信をするための準備(ただしPrivilegedアプリのみ) ref: http://qiita.com/sakadon/items/d209076dc36e86484ad5
"type": "privileged",
"permissions": {
"tcp-socket": {
"description": "connect to IRC servers."
}
},
@sakadon
sakadon / certkey.json
Last active November 5, 2015 18:59
Google SpreadSheetsをGoogle APIs Client Library for PHP 1.1.6で叩くための準備 ref: http://qiita.com/sakadon/items/84593201b8801a8a3a8a
{
"private_key_id": "################",
"private_key": "-----BEGIN PRIVATE KEY-----\#####################################################################################################-----END PRIVATE KEY-----\n",
"client_email": "########@developer.gserviceaccount.com",
"client_id": "#########gsa.apps.googleusercontent.com",
"type": "service_account"
}
@sakadon
sakadon / file0.php
Created November 6, 2015 19:38
オブジェクトに対して、オブジェクトを後ろに追加したい ref: http://qiita.com/sakadon/items/548703904bfe70df5d06
//$objects = 10個ぐらいで、
//$objects->name = 'unko' は3個としよう
$push = new ArrayObject();
foreach( $objects as $object ){
if( $object->name == 'unko' ){
$push->append( $object );
}
}
count($push); // -> 3
@sakadon
sakadon / file0.php
Last active November 7, 2015 11:21
Google APIs Client Library for PHPでgd:etagを取得する ref: http://qiita.com/sakadon/items/34552fb99669d6879466
$sheet_id = '#########';
$request = new Google_Http_Request(
"https://spreadsheets.google.com/feeds/worksheets/{$sheet_id}/private/full?alt=json",
"GET",
array(
"Authorization" => "Bearer {$this->token}",
"GData-Version" => "3.0"
)
);
@sakadon
sakadon / Gemfile
Last active November 10, 2015 07:51
railsでriotjsをセットアップする+riotjsからjsonをとってくる(via jQuery.get) ref: http://qiita.com/sakadon/items/c6d291c1798e18b739a5
gem 'riot_js-rails'
@sakadon
sakadon / file0.txt
Last active November 26, 2015 09:17
ブロックチェーンって何?Ryan X. Charles氏のfullnode (alpha)を実行してみた ref: http://qiita.com/sakadon/items/f64a38fa647a05ca5d77
$ git clone git@github.com:ryanxcharles/fullnode.git
$ cd fullnode
$ npm install
$ gulp
$ chmod 777 bin/testapp.js
$ ./bin/testapp.js