Skip to content

Instantly share code, notes, and snippets.

import * as AWS from 'aws-sdk'
export const fetch = async (startKey?: AWS.DynamoDB.Key | undefined) => {
const ddb = new AWS.DynamoDB({
endpoint: 'http://localhost:8000'
})
const limit = 6
const defaultInput: AWS.DynamoDB.ScanInput = {
type VDate = Date
type VDateContext = {
current: (actualBase?: Date) => VDate;
toVirtual: (date: Date) => VDate;
toActual: (date: VDate) => Date;
mapToVirtual: (date: Date, actualBase?: Date) => VDate;
}
const createContext = (factor: number, _virtualBase?: Date): VDateContext => {
#!/bin/bash
_puts() {
echo "$1" >&2
}
# NOTE: https://docs.aws.amazon.com/ja_jp/systems-manager/latest/userguide/getting-started-configure-preferences-cli.html
ssm_configuration="$(
cat <<EOS | sed "s/__SESSION_LOGS_BUCKET__/$SESSION_LOGS_BUCKET/g"
{
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Notification for SSM Session Manager
Globals:
Function:
Timeout: 60
Parameters:
#!/bin/sh
if [[ "$1" != "up" ]]; then
exit 1
fi
typing () {
text="$1"
length=${#text}
function isValid() {
return (
isSpecifiedUser() ||
(
request.resource.data.privateKey1 == resource.data.privateKey1 &&
request.resource.data.privateKey2 == resource.data.privateKey2 &&
'publicKey' in request.resource.data
)
) && (
request.resource.data.keys().hasOnly(['privateKey1', 'privateKey2' 'publicKey'])
@tatat
tatat / sampler.swift
Created February 12, 2019 03:30
Some notes don't play a sound.
import Foundation
import AVFoundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
// NOTE: ~/Documents/Shared Playground Data/GeneralUser GS v1.471.sf2
// http://schristiancollins.com/generaluser.php
let url = PlaygroundSupport.playgroundSharedDataDirectory.appendingPathComponent("GeneralUser GS v1.471.sf2")
@tatat
tatat / with-local-storage.js
Last active November 10, 2018 08:52
動作未確認
const persistedStore = {
state: {},
load() {
this.state = JSON.parse(localStorage.getItem('state'))
},
watch(vm, key) {
return vm.$watch(key, (value) => {
@tatat
tatat / with-local-storage.js
Last active November 10, 2018 08:16
動作未確認
const store = {
state: {},
load() {
this.state = JSON.parse(localStorage.getItem('state'))
},
watch(vm, key) {
return vm.$watch(key, (value) => {
localStorage.setItem('state', JSON.stringify(value))
@tatat
tatat / u.ts
Created September 27, 2018 07:43
function FuckingPredeterminedMethodName(fuckinName: string) {
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
target.__fuckingPredeterminedMethodNameCalled__ = target.__fuckingPredeterminedMethodNameCalled__ || {}
target.__fuckingPredeterminedMethodNameCalled__[fuckinName] = 0
target[fuckinName] = function() {
if (++ target.__fuckingPredeterminedMethodNameCalled__[fuckinName] > 3) {
throw new Error('Stop it!')
} else {
console.warn(`Do not call me ${ fuckinName }.`)