Skip to content

Instantly share code, notes, and snippets.

@fujiwara
fujiwara / config.yml
Created Feb 21, 2020
aws-cli-v2 orb
View config.yml
orbs:
aws-cli-v2:
commands:
install:
steps:
- run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
@fujiwara
fujiwara / fluentd.conf
Last active Feb 7, 2020
fix fluentd tags from firelens
View fluentd.conf
<match *-firelens-*>
@type firelens_tag_filter
</match>
<match app.firelens.**>
# ...
</match>
@fujiwara
fujiwara / graph-depends-on.pl
Created May 29, 2019
Visualize container dependencies from ECS task definition JSON.
View graph-depends-on.pl
#!/usr/bin/env perl
use 5.12.1;
use warnings;
use JSON::PP;
my $file = shift;
open my $in, "<", $file or die $!;
my $taskdef = JSON::PP::decode_json(do { local $/ = undef; <$in> });
my $g = $file;
View slack_reporter.pl
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use 5.014;
use Encode;
use JSON::PP qw/encode_json decode_json/;
use Sys::Hostname;
use IPC::Open2;
@fujiwara
fujiwara / index.js
Created Feb 22, 2019
Lambda Edge redirector
View index.js
exports.handler = async (event, context, callback) => {
const response = {
status: "302",
statusDescription: "Found",
headers: {
location: [{
key: 'Location',
value: 'http://contents.xj-storage.jp/xcontents/AS01527/ec0b38f1/7c8b/4dbc/89e1/106de9ea3108/20190108140352250s.pdf',
}],
}
@fujiwara
fujiwara / main.go
Created Feb 18, 2019
cloudwatch-to-mackerel
View main.go
package main
import (
"context"
"encoding/json"
"errors"
"log"
"os"
"time"
@fujiwara
fujiwara / main.go
Created Feb 15, 2019
Convert GetMetricData results to Mackerel metric format.
View main.go
package main
import (
"encoding/json"
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
View retryable-bouncer.go
package main
import (
"flag"
"io"
"log"
"net"
"sync"
"time"
View bench.pl
use 5.12.0;
use Benchmark qw/:all/;
my @src = 1 .. 1000;
cmpthese 0, {
push => sub {
my @dest;
for (@src) {
push @dest, $_;
@fujiwara
fujiwara / nginx.conf
Last active Jun 7, 2018
nginx dynamic mirror
View nginx.conf
$ curl -H"X-Mirror1: 127.0.0.1:5000" -H"X-Mirror2: 127.0.0.1:5001" -H"X-Mirror3: 127.0.0.1:5002" localhost:8000