Skip to content

Instantly share code, notes, and snippets.

@yyano
yyano / numbering.js
Last active December 15, 2017 11:17
Amazon DynamoDBとAWS Lambdaを使ってナンバリング(採番)する。Node.js
"use strict";
var AWS = require('aws-sdk');
var documentClient = new AWS.DynamoDB.DocumentClient();
function asyncPutDb(hashKey) {
return new Promise(function(resolve, reject) {
var params = {
TableName: process.env.DYNAMODB_TABLENAME,
@yyano
yyano / QiitaNews.go
Created December 5, 2017 12:51
Qiita API v2で記事一覧を取得して、Markdown記法で日付ごとのファイルの先頭に追記していく。
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"time"
@yyano
yyano / loop-date.go
Last active November 26, 2017 02:30
Go言語で日付のループ処理。2015年12月01日から今日までを1日ずつ表示する。 Loop by date.(from 01 dec 2015, to Today)
package main
import (
"log"
"time"
)
func main() {
time.Parse("2006-01-02", "2015-12-01")
for d := fromDate; d.Unix() < time.Now().Unix(); d = d.AddDate(0, 0, 1) {
@yyano
yyano / AWSLambda20171015.cs
Last active April 21, 2022 02:22
AWS Lambdaにて、S3からPDFファイルを/tmpにダウンロード。そして、/tmpからS3へアップロード
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Amazon.Lambda.Core;
using Amazon.S3;
using Amazon.S3.Model;
@yyano
yyano / convertE164toDomestic.php
Last active October 8, 2017 14:20
E.164 Format phone Number, Convert to contry-code and Domestic phone number.
<?php
var_dump(convertE164toDomestic("+81399999999");
public static function convertFromE164($E164Number)
{
$contryLength = 1;
$country = substr($E164Number, 1, $contryLength);
switch ($country) {
case '1': $contryLength = 1; break;