View api-client.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
WAIT=10 | |
NEXT=0 | |
SESSION=`curl -s https://~/start | jq -r .session_id` | |
LAST=0 | |
gpspipe -w | jq --unbuffered -c '. | if .class == "TPV" then {lat,lon,time} else empty end' | while read -r f; do | |
CURRENT=`date +%s` | |
TARGET=$(( LAST + WAIT )) |
View apigateway-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"TableName": "データ蓄積テーブル", | |
"Item": { | |
"session_id": { | |
"S": "$input.path('$.session_id')" | |
}, | |
"time": { | |
"S": "$input.path('$.time')" | |
}, | |
"lat": { |
View create-session-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
AWS.config.update({ | |
'region': 'ap-northeast-1' | |
}); | |
const dynamo = new AWS.DynamoDB.DocumentClient(); | |
exports.handler = (event, context, callback) => { | |
const l = 8; | |
const c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
View iam-role-trust.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": [ | |
"apigateway.amazonaws.com", | |
"lambda.amazonaws.com" | |
] |
View iam-role-policy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "Stmtxxxxxxxx", | |
"Effect": "Allow", | |
"Action": [ | |
"dynamodb:PutItem", | |
"dynamodb:Scan" | |
], |
View mysqlinapp.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('ENV_STR', 'MYSQLCONNSTR_localdb'); | |
$return = array('result' => false); | |
if (isset($_SERVER[ENV_STR])) { | |
$connectStr = $_SERVER[ENV_STR]; | |
$return['connection'] = array( | |
'host' => preg_replace("/^.*Data Source=(.+?);.*$/", "\\1", $connectStr), |
View cw2redis.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"github.com/garyburd/redigo/redis" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
View testApp.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add [ int lineLine ] in testApp.h | |
void testApp::draw(){ | |
srand((unsigned int)time(NULL)); | |
int red = rand() % 124 + 124; | |
int green = rand() % 124 + 124; | |
int blue = rand() % 124 + 124; | |
ofSetLineWidth(10); |
View testApp.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add [ int lineLine ] in testApp.h | |
void testApp::draw(){ | |
if(lineLine == RECT_SIZE) { | |
lineLine = 0; | |
} | |
ofSetColor(255, 255, 255, 255-lineLine); | |
ofRect(0, 0+lineLine, RECT_SIZE, 20); |
View backup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
_dir='/path/to/target/' | |
_target=`date +"%Y%m"` | |
if test ! -d $_dir$_target | |
then | |
mkdir $_dir$_target | |
_last=`date -d '1 month ago' +"%Y%m"` |