Skip to content

Instantly share code, notes, and snippets.

Toshihiko Kimura taiko19xx

Block or report user

Report or block taiko19xx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View api-client.sh
#!/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
{
"TableName": "データ蓄積テーブル",
"Item": {
"session_id": {
"S": "$input.path('$.session_id')"
},
"time": {
"S": "$input.path('$.time')"
},
"lat": {
View create-session-script.js
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
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.amazonaws.com",
"lambda.amazonaws.com"
]
View iam-role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmtxxxxxxxx",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"dynamodb:Scan"
],
@taiko19xx
taiko19xx / mysqlinapp.php
Created Nov 12, 2016
Get "MySQL In App(Azure)" connection string.
View mysqlinapp.php
<?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 Jan 18, 2016
チャットワークのメッセージをRedisに突っ込むやつ
View cw2redis.go
package main
import (
"encoding/json"
"github.com/garyburd/redigo/redis"
"io/ioutil"
"log"
"net/http"
)
@taiko19xx
taiko19xx / testApp.cpp
Created Dec 23, 2013
プロジェクションマッピング勉強会(openFramework)で作ったスクリプトその2
View testApp.cpp
// 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 Dec 23, 2013
プロジェクションマッピング勉強会(openFramework)で作ったスクリプトその1
View testApp.cpp
// 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 Mar 3, 2013
mysqldump with gzip(monthly)
View backup.sh
#!/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"`
You can’t perform that action at this time.