Skip to content

Instantly share code, notes, and snippets.

# Dashboard
The dashboard is a grid of configurable **widgets** rendered on the IDE home view. It is authored visually (drag/resize/configure in edit mode) and persisted as a `.dashboard` YAML file in the user's Drive. Everything is local-first: edits update the IndexedDB cache and are reflected to Drive via the normal Push flow.
> Implementation lives under `app/dashboard/`. The Japanese mirror of this doc is `dashboard_ja.md`.
## File format & storage
- A dashboard is a YAML file with the `.dashboard` extension.
- New dashboards are stored at `dashboards/{name}.dashboard`. A legacy single dashboard may exist at the root as `home.dashboard`.
@takeshy
takeshy / index.js
Created February 25, 2020 08:55
firehose_to_elasticsearch_with_slack_notify_on_error
const https = require('https');
const postSlack = (rec)=>{
return new Promise((resolve, reject)=>{
const path = rec.ecs_cluster.match(/staging/) ? process.env.STAGING_SLACK_PATH : process.env.PRODUCTION_SLACK_PATH;
const data = JSON.stringify({ text: JSON.stringify(rec) });
const options = {
hostname: 'hooks.slack.com',
port: 443,
path,
@takeshy
takeshy / firehose-cloudwatch-logs-processor-elasticsearch_by_cloudwatch_subscription.js
Created February 23, 2020 03:49
kinesys firehose by cloudwatch subscription to elasticsearch
/*
For processing data sent to Firehose by Cloudwatch Logs subscription filters.
Cloudwatch Logs sends to Firehose records that look like this:
{
"messageType": "DATA_MESSAGE",
"owner": "123456789012",
"logGroup": "log_group_name",
"logStream": "log_stream_name",
@takeshy
takeshy / firehose-cloudwatch-logs-processor-elasticsearch_by_cloudwatch_subscription.js
Created February 23, 2020 03:48
kinesys firehose by cloudwatch subscription to elasticsearch
/*
For processing data sent to Firehose by Cloudwatch Logs subscription filters.
Cloudwatch Logs sends to Firehose records that look like this:
{
"messageType": "DATA_MESSAGE",
"owner": "123456789012",
"logGroup": "log_group_name",
"logStream": "log_stream_name",
@takeshy
takeshy / enhancedDispatch.ts
Last active November 18, 2019 02:16
promise custom hooks
import { Actions, AppState } from "./reducers/index";
import { useReducer, useMemo, useRef, useEffect } from "react";
import withPromise from "./withPromise";
const groupStart =
process.env.NODE_ENV !== "production"
? (val: string) => {
console.groupCollapsed("Action Type:", val);
}
: (val: string) => {};
@takeshy
takeshy / log2bin.rb
Last active September 24, 2019 08:16
#!/usr/bin/ruby
if ARGV.length != 1
puts "#{$0} outputfile"
exit -1
end
unless file = File.open(ARGV[0],"wb")
puts "#{$0} outputfile"
puts "#{ARGV[0]} can't write"
exit -1
@takeshy
takeshy / vscofnig.json
Created June 23, 2019 05:40
settings json for vs code
{
"editor.minimap.enabled": false,
"editor.formatOnSave": true,
"tslint.alwaysShowRuleFailuresAsWarnings": true,
"window.zoomLevel": 2,
"explorer.confirmDelete": false,
"files.trimTrailingWhitespace": true,
"files.eol": "\n",
"typescript.updateImportsOnFileMove.enabled": "always"
}
@takeshy
takeshy / .vimrc
Created November 15, 2018 02:41
remove trailing space on save
function! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre *.ts,*.rb,*.tsx,*.js,*.erb :call <SID>StripTrailingWhitespaces()
#!/usr/bin/env ruby
require 'nkf'
raw = File.read("#{ENV['HOME']}/Downloads/EIJIRO-1445.TXT")
data = NKF.nkf("-w -d", raw)
results = {}
first_flg = false
data.each_line do |raw_line|
next if !first_flg && !raw_line.match(/a\s+{不-1}/)
#!/usr/bin/ruby
require 'rubygems'
require 'mysql'
require 'optparse'
options = {
:database => '',
:host=> 'localhost',
:create=> false,
:count=> false,
:index=> false,