Skip to content

Instantly share code, notes, and snippets.

View e2kaneko's full-sized avatar

tomo kaneko e2kaneko

View GitHub Profile
@e2kaneko
e2kaneko / sabun.php
Created June 2, 2020 11:58
開発チームの課題(20点)
<?php
// 入力
$input = [1, 5, 6, 3, 2, 6];
//$input = [1, 2, 3, 4];
// PHP 配列 初期化 連番でGoogle
$seikai = range(1, count($input));
// ①存在するはずだけど存在しない数値を取得
@e2kaneko
e2kaneko / js
Created December 25, 2019 04:37
S3に格納されたAWS WAFログをSNSで通知する(Lambda, Node.js)
const aws = require("aws-sdk");
const s3 = new aws.S3();
var sns = new aws.SNS({region: 'ap-northeast-1'});
var zlib = require('zlib');
exports.handler = (event, context, callback) => {
const params = {
Bucket: "aws-waf-logs-corporate-s3",
Key: event.Records[0].s3.object.key
};
@e2kaneko
e2kaneko / cf.yml
Created February 6, 2019 13:32
CloudFormationで自身のセキュリティグループIDをターゲットにするグループを作成する
InternalSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref FirstVPC
GroupName: !Sub "internal-sg"
GroupDescription: "Internal SG"
InternalSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
@e2kaneko
e2kaneko / trace.java
Created October 8, 2018 04:53
例外トレースを文字列に変換
/**
* 例外メッセージのトレース情報を文字列に変換します
* @param exception 例外オブジェクト
* @return 例外トレース文字列
*/
protected String getTraceString(Exception exception) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
exception.printStackTrace(printWriter);
printWriter.flush();
### Keybase proof
I hereby claim:
* I am e2kaneko on github.
* I am e2kaneko (https://keybase.io/e2kaneko) on keybase.
* I have a public key whose fingerprint is D4AD 7848 BA34 4C0C DBD4 76BD 8EDE 961C 5F70 2D42
To claim this, I am signing this object:
<meta name="robots" content="noindex,nofollow,notranslate,noodp,noarchive">
@e2kaneko
e2kaneko / gist:7a384ae90457e95501a6bdd0f829a1cf
Created July 18, 2016 05:05
mysqlコマンドで結果を縦表示
# command \G
# 例
mysql > show slave status \G;
************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.1.1
Master_User: repladmin
Master_Port: 3306
Connect_Retry: 60
@e2kaneko
e2kaneko / gist:b2a9e42e17fc6d4e346e25fd842bee93
Created July 2, 2016 02:13
digコマンドでネームサーバを指定
# @【NS】を付与
dig yahoo.co.jp any @ns01.yahoo.co.jp
@e2kaneko
e2kaneko / gist:4ab1195cc7476b402a7120de27d46b0e
Created July 2, 2016 02:06
rootサーバからのDNSトレース
dig yahoo.co.jp any +trace