Skip to content

Instantly share code, notes, and snippets.

#!/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 ))
{
"TableName": "データ蓄積テーブル",
"Item": {
"session_id": {
"S": "$input.path('$.session_id')"
},
"time": {
"S": "$input.path('$.time')"
},
"lat": {
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";
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.amazonaws.com",
"lambda.amazonaws.com"
]
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmtxxxxxxxx",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"dynamodb:Scan"
],
@taiko19xx
taiko19xx / mysqlinapp.php
Created November 12, 2016 03:56
Get "MySQL In App(Azure)" connection string.
<?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),
@taiko19xx
taiko19xx / cw2redis.go
Created January 18, 2016 11:12
チャットワークのメッセージをRedisに突っ込むやつ
package main
import (
"encoding/json"
"github.com/garyburd/redigo/redis"
"io/ioutil"
"log"
"net/http"
)
@taiko19xx
taiko19xx / testApp.cpp
Created December 23, 2013 14:56
プロジェクションマッピング勉強会(openFramework)で作ったスクリプトその2
// 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);
@taiko19xx
taiko19xx / testApp.cpp
Created December 23, 2013 14:55
プロジェクションマッピング勉強会(openFramework)で作ったスクリプトその1
// 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);
@taiko19xx
taiko19xx / backup.sh
Created March 3, 2013 08:03
mysqldump with gzip(monthly)
#!/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"`