Skip to content

Instantly share code, notes, and snippets.

View tmtk75's full-sized avatar

Tomotaka Sakuma tmtk75

View GitHub Profile
@tmtk75
tmtk75 / main.go
Last active July 3, 2021 01:28
Full example for DynamoDB batch-get-item in golang
module github.com/tmtk75/m
go 1.16
require (
github.com/aws/aws-sdk-go-v2/config v1.4.1 // indirect
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.4.0 // indirect
)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tmtk75
tmtk75 / list-reminders.swift
Created July 13, 2019 07:00
List your reminders in JSON
import Darwin
import EventKit
import Foundation
var debug = false
if ProcessInfo.processInfo.environment["DEBUG"] != nil {
debug = true
}
// https://stackoverflow.com/questions/28016578/how-to-create-a-date-time-stamp-and-format-as-iso-8601-rfc-3339-utc-time-zone
@tmtk75
tmtk75 / switchMap-sample.ts
Created May 21, 2019 00:30
RxJS switchMap sample
import { of, interval, never } from "rxjs";
import { map, switchMap } from "rxjs/operators";
const a = of(1, 2, 3, 4);
const b = of(1, 2, 3, 4).pipe(map(e => e * 10));
const c = of(1, 2, 3, 4).pipe(map(e => e * 100));
const main = interval(1000).pipe(
switchMap(i => {
switch (i % 3) {
//import Cocoa
//var str = "Hello, playground"
import EventKit
let eventStore = EKEventStore()
func allowAuthorization() {
if getAuthorization_status() {
// 許可されている
return
@tmtk75
tmtk75 / lunr-sample.js
Created April 29, 2019 00:07
Lunr sample
const lunr = require("lunr");
const lunrstemmer = require("lunr-languages/lunr.stemmer.support");
const lunrtinyseg = require("lunr-languages/tinyseg");
const lunrja = require("lunr-languages/lunr.ja");
lunrstemmer(lunr);
lunrtinyseg(lunr);
lunrja(lunr);
// console.trace("init lunr");
@tmtk75
tmtk75 / main.go
Created October 3, 2018 03:37
Concatenate image files in .png vertically
package main
import (
"flag"
"fmt"
"image"
"image/draw"
"image/png"
"log"
"math"
@tmtk75
tmtk75 / hover.html
Created January 9, 2017 23:21
Detection hover more than 500 milliseconds with RxJS
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
#main { display: flex; flex: 1; }
.node { border: 1px solid gray; width: 160px; height: 100px; margin: 1px; }
.node:hover { background-color: rgba(0, 0, 0, 0.1); }
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.0.1/Rx.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
@tmtk75
tmtk75 / ls-ec2.sh
Last active January 28, 2016 06:48
#!/usr/bin/env bash
sort_key=${1-Name}
aws ec2 describe-instances \
--output table \
--filter Name=instance-state-name,Values=running \
Name=tag-key,Values=role \
Name=tag-key,Values=site \
--query '
sort_by(
Reservations[].Instances[],
@tmtk75
tmtk75 / index.ios.js
Created January 10, 2016 02:24
GitHum Users viewer in react-native
import React, {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
Image,
NavigatorIOS,
TouchableWithoutFeedback,
WebView