Skip to content

Instantly share code, notes, and snippets.

View hassaku63's full-sized avatar

Takuya Hashimoto hassaku63

View GitHub Profile
@hassaku63
hassaku63 / codepipeline-start-pipeline-execution-sampe.ts
Created June 19, 2023 12:35
AWS SDK for Node.js (v3) で CodePipeline StartPipelineExecution API を実行するサンプル
import {
CodePipelineClient,
StartPipelineExecutionCommand,
StartPipelineExecutionCommandOutput,
ConflictException,
} from "@aws-sdk/client-codepipeline";
type StartPipelineExecutionResultFailed = {
success: false,
error: Error,
@hassaku63
hassaku63 / SECCON Beginners CTF 2023.md
Last active June 4, 2023 05:29
SECCON Beginners CTF 2023

URL: https://score.beginners.seccon.jp/

今回 CTF 初挑戦だったので、やってたこと、考えてたことなどを雑にメモっていく場所。

マジで何もわかっていないで書いてるので、(これを見てしまった人向けに)正解にたどり着きたい人、参考情報を得たい人が見るような「資料」じゃないことを予め断っておく。

自分が何考えてたのかをある程度 dump したものであって、バックグラウンドを理解して書いてるものではない。

競技日程

@hassaku63
hassaku63 / main.go
Created December 25, 2022 10:42
AWS SDK for Go 使ってみる
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/aws/aws-sdk-go/service/sts"
)
func main() {
@hassaku63
hassaku63 / tokenizer.py
Created November 6, 2022 16:20
Python で S式(整数の四則演算だけ)を字句解析する
from enum import Enum
from functools import wraps
def assert_simgle_char(f):
@wraps(f)
def inner(c: str):
if len(c) != 1:
raise ValueError(c)
return f(c)
@hassaku63
hassaku63 / main.go
Last active November 6, 2022 13:57
Type switch
package main
import (
"fmt"
"time"
)
func main() {
typeSwitch := func(v interface{}) {
switch v.(type) {
@hassaku63
hassaku63 / main.go
Last active July 27, 2022 18:30
[Golang] map, struct を要素に持つリストをソートする例
package main
import (
"encoding/json"
"fmt"
"log"
"sort"
)
type Person struct {
@hassaku63
hassaku63 / main.rs
Created July 18, 2022 07:48
ユーザー定義の構造体をいい感じに print できるように fmt トレイトを実装する
use std::fmt;
struct Circle {
radius: u32
}
impl Circle {
fn diameter(&self) -> u32 {
self.radius * 2
}
@hassaku63
hassaku63 / handler.py
Created May 2, 2022 16:08
example lambda (python) handler processing subscribed CloudWatch Logs log event (via kinesis data stream)
import json
import gzip
import logging
from base64 import b64decode
log = logging.getLogger(__name__)
def handler(event, context):
@hassaku63
hassaku63 / serverless.yml
Created May 2, 2022 16:00
Example using subscription filter for StateMachine execution fail (delivery to kinesis data stream)
resources:
Resouces:
SmSubscription:
Type: AWS::Logs::SubscriptionFilter
Properties:
LogGroupName: !Ref StateMachineLogGroup
FilterPattern: ExecutionFailed
DestinationArn: !GetAtt [JobFailureEventStream, Arn]
RoleArn: !GetAtt [KinesisSubscriptionRole, Arn]
JobFailureEventStream:
@hassaku63
hassaku63 / send-get-request-to-opensearch-using-curl-with-sigv4.sh
Last active March 22, 2024 20:17
Send GET request to OpenSearch Domain using curl with sig4 signature
aws_region='ap-northeast-1'
endpoint="https://DOMAIN_NAME.${aws_region}.es.amazonaws.com/"
AWS_ACCESS_KEY_ID='foo'
AWS_SECRET_ACCESS_KEY='bar'
curl $endpoint --verbose --aws-sigv4 "aws:amz:${aws_region}:es" --user "${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}"