Skip to content

Instantly share code, notes, and snippets.

View kubosuke's full-sized avatar
🏠
Working from home

Keisuke Kubota kubosuke

🏠
Working from home
View GitHub Profile
@kubosuke
kubosuke / sequential_jobqueue.go
Last active October 22, 2024 13:20
Go sequential cronjob sample
package main
import (
"fmt"
"log"
"os"
"os/signal"
"sync"
"syscall"
"time"
@kubosuke
kubosuke / recursion.md
Created April 24, 2024 08:42
Performance test of Enumeration, Body-recursive, Tail-recursive in Elixir
@kubosuke
kubosuke / reload_config.groovy
Created February 20, 2024 04:32
for reloading config.xml after edit
import java.io.InputStream;
import java.io.FileInputStream
import java.io.File;
import javax.xml.transform.stream.StreamSource
def hudson = hudson.model.Hudson.instance;
Jenkins.instance.getAllItems(AbstractProject.class).each {job ->
if (job.fullName.startsWith("YourFolder/")) {
def configXMLFile = job.getConfigFile();
@kubosuke
kubosuke / Kafka.md
Last active January 28, 2024 06:07

This document is written based on below:

Apache Kafka Series - Learn Apache Kafka for Beginners v3 https://learning.oreilly.com/course/apache-kafka-series/9781789342604/ by Stéphane Maarek

Kafka in 5min

Messaging queue benefits

  • able to adjust protocols (convert TCP, HTTP, FTP etc) into what the subscriber wants
  • able to adjust data formats (binary, csv, json, avro, protobuf)
@kubosuke
kubosuke / fastapi-template.py
Last active January 18, 2024 06:38
template for CRUD REST with fastapi
from typing import List
from pydantic.dataclasses import dataclass
from fastapi import APIRouter, FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from pydantic import BaseModel
# Domain Layer
# Domain Object (Entities & Value Objects)

What's eBPF?

kernel technology that allows developers to write custom codes that can be loaded into the kernel dynamically.

it's used for:

  • performance tracing
  • networking
  • detecting malicious activity
@kubosuke
kubosuke / SQL-Antipattern.md
Last active January 6, 2024 13:12
SQL Antipattern

SQL Antipattern

1. Jaywalk

Purpose

store attribute that has multiple values

@kubosuke
kubosuke / pydantic.md
Last active January 29, 2024 08:20
pydantic.py

Static typing

Able to raise error when the args does not match with predefined type

# from dataclasses import dataclass
from pydantic.dataclasses import dataclass


@dataclass
@kubosuke
kubosuke / delete-stale-metrics-from-pushgateway.py
Last active September 9, 2024 05:24
Delete stale metrics from pushgateway
from datetime import datetime, timedelta
import os
import requests
from prometheus_client.parser import text_string_to_metric_families
PUSHGATEWAY_METRICS_URL = "https://xxx.com/metrics"
PUSH_TIME_METRICS_NAME = "push_time_seconds"
@kubosuke
kubosuke / java-oom-thread-limit.md
Last active January 6, 2024 14:27
java-oom-thread-limit.md

check max limit of fd

Background

Exception in thread "qtp859985937-5877" java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached

Howto