Skip to content

Instantly share code, notes, and snippets.

View kurochan's full-sized avatar
🎯
Focusing

Kurochan kurochan

🎯
Focusing
View GitHub Profile
@kurochan
kurochan / LICENSE.txt
Last active March 8, 2025 17:07
Demo Code for Ghostty
MIT License
Copyright (c) 2024 kurochan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@kurochan
kurochan / datadog.go
Created December 4, 2024 15:25
Datadog APMのtrace contextをmedia playlistに埋める
package datadog
import (
"bytes"
"encoding/base64"
"encoding/binary"
"fmt"
"strings"
"time"
@kurochan
kurochan / go.mod
Created May 28, 2023 12:19
Redis ID generator benchmark
module ridgen
go 1.20
require (
github.com/go-redis/redis/v8 v8.11.5
golang.org/x/sync v0.2.0
)
require (
package main; import ( "fmt"; "html"; "lo
"net/http"; "strconv"; "strings"; "time"
trolMessage struct { Target string; Count
func main() { controlChannel := make(chan
sage);workerComplechan := make(chan boo
PollChannel := make(chan chan bool); work
false; go admin(controlChannel, statusPoll
{ select { case respChan := <- statusPoll
Chan <- workerActive; case msg := <- countr
workerActive = true; go doStuff(msg, work
@kurochan
kurochan / gcs_calc.rb
Created October 28, 2022 03:15
GCSの費用簡易計算
# 毎月増えるログの量
log_size = 500
# 何ヶ月先までのコストを計算するか
target_month = 12 * 5
# 1ドル何円換算するか
exchange_rate = 145
# 満何ヶ月後にnearlineに移動させるか
nearline_threshold = 12
# 満何ヶ月後にcoldlineに移動させるか
coldline_threshold = 24
@kurochan
kurochan / generate_ip_list.sql
Last active August 17, 2022 03:37
Example of Generate IP Address list from IPv4 prefilx list on Snowflake
with parse_ip as (
select
1 as k,
column1,
parse_ip(column1, 'INET'): ipv4 as ipv4,
power(2, 32 - parse_ip(column1, 'INET'): netmask_prefix_length) as subnet_size
from (values ('192.168.1.0/28'), ('172.16.1.0/29'))
),
ip_generated as (
select
select
TABLE_CATALOG AS DB_NAME,
TABLE_SCHEMA AS SCHEMA_NAME,
TABLE_NAME AS TABLE_NAME,
COLUMN_NAME AS COLUMN_NAME,
COLUMN_DEFAULT AS DEFAULT_VALUE,
IS_NULLABLE AS IS_NULLABLE,
CASE WHEN DATA_TYPE in (
'VARCHAR', 'CHAR', ' CHARACTER', 'STRING',
'TEXT'
@kurochan
kurochan / ssh-ssm-sample.config
Last active June 1, 2024 20:45
ssh script with ssm port forward
Host stg-bastion
User ec2-user
TCPKeepAlive yes
ProxyCommand env PATH=/usr/local/bin:~/.local/bin:$PATH /path/to/ssm-session.sh -n stg-bastion -e stg -p aws-profile -m proxy
Host stg-db-proxy
User ec2-user
TCPKeepAlive yes
ProxyCommand /path/to/ssm-session.sh -n stg-bastion -e stg -p aws-profile -m proxy
LocalForward 3306 10.0.1.123:3306
@kurochan
kurochan / GetSystemProperty.scala
Created July 11, 2021 16:52
investigation of Snowpark runtime environment
package org.kurochan.snowpark_test
import com.snowflake.snowpark._
import com.snowflake.snowpark.functions._
import collection.JavaConverters._
object Main {
def createSession(): Session = {
val configs = Map (
"URL" -> "https://xxxxxxx.ap-northeast-1.aws.snowflakecomputing.com:443",