Skip to content

Instantly share code, notes, and snippets.

View nobel6018's full-sized avatar
🦊
Hello!!

Lee, YoungHoon nobel6018

🦊
Hello!!
View GitHub Profile
@nobel6018
nobel6018 / TestExceptionByAssertJ.kt
Created July 24, 2022 10:54
kotlin test exception by JUnit5 and AssertJ
import org.assertj.core.api.Assertions.assertThatThrownBy
import org.junit.jupiter.api.Test
@Test
fun `test exception1 - AssertionJ`() {
assertThatThrownBy {
// lambda 부분입니다. 실행할 코드를 작성합니다.
val list = listOf(1, 2, 3, 4)
list.get(100)
}
@nobel6018
nobel6018 / aws-lambda-post.js
Last active May 24, 2022 00:08
AWS Lambda POST 요청, Javascript, https is pre-built library (no image needs)
const https = require('https');
exports.handler = async (event) => {
console.log("event: ", event);
const options = {
hostname: "gist.github.com", // replace correctly
port: 443,
path: '/v1/articles', // replace correctly
method: 'POST',
@nobel6018
nobel6018 / 1. TeaType.kt
Last active April 15, 2022 03:28
jackson set kotlin enum class as camelCase
enum class TeaType {
GREEN_TEA, HERBAL_TEA
;
fun String.snakeToLowerCamelCase(): String {
val snakeRegex = "_[a-zA-Z]".toRegex()
return snakeRegex.replace(this.lowercase()) {
it.value.replace("_","")
.uppercase()
}
@nobel6018
nobel6018 / main.py
Created November 21, 2021 07:23
IP set 추출하고 가공해서 생성하는 코드
ipv4_set = []
ipv6_set = []
with open("ip-table.csv") as f:
for row in f:
ip = row.split(',')[0]
if ':' in ip:
ip += '/128'
ipv6_set.append(ip)
else:
if ip.count('.') == 3: # to ignore header
pipeline {
agent any
stages {
stage('GitClone') {
steps {
git url: 'https://github.com/nobel6018/pubsub-study.git'
}
}