Skip to content

Instantly share code, notes, and snippets.

View wickedev's full-sized avatar

Jeong-Yun Ryan Yang wickedev

  • Greenlabs
  • Anyang si, South Korea
View GitHub Profile
@wickedev
wickedev / fzftail.sh
Last active October 24, 2021 15:02
fzf + tail + nl
#!/bin/bash
tail -n +0 $1 \
| nl -ba \
| fzf --multi \
--ansi \
--no-sort \
--reverse \
--tac \
--preview 'sed -n "$(({n}-4)),$(({n}+6))p" '$1' | nl -v $(({n}-4)) -ba' \
@wickedev
wickedev / bitwise-config.test.ts
Last active December 16, 2020 02:06
Handling complex condition without if statements with bitwise operators and bit masks
/*
+--------------------------------+---------------+
| type | bitmask |
+--------------------------------+---------------+
| mode (light, dark) | 0b0100 |
| screen size (xs, sm, md, lg) | 0b0011 |
+--------------------------------+---------------+
*/
type Bits = number;
@wickedev
wickedev / Main.ktx
Last active December 16, 2021 05:09
kotlin extension language for type safe macro
import react.dom.*
import react.styled
import kotlinx.browser.document
import org.w3c.dom.Window
import io.grpc
import org.graphql
val greetStub = grpc.stub!("proto/greeter.proto") // Type Inference & Code Generation from file contents
val Content = styled.div! {
#!/bin/bash
gitlab_ci () {
gitlab-runner exec docker "$1" \
--cache-dir=/tmp/gitlab-cache \
--docker-cache-dir=/tmp/gitlab-cache \
--docker-volumes=/tmp/gitlab-cache \
--docker-volumes="$PWD"/deploy:/deploy \
--env=DOCKER_CONFIG_JSON=/deploy/config.json \
--env=DEPLOY_KUBECONFIG=/deploy/kubeconfig \
#!/bin/bash
helm upgrade -i efk stable/elastic-stack -n kube-system \
--set elasticsearch.image.tag=6.7.0 \
--set kibana.image.tag=6.7.0 \
--set fluent-bit.backend.type=es \
--set fluent-bit.backend.es.host=efk-elasticsearch-client.kube-system.svc.cluster.local \
--set kibana.env.ELASTICSEARCH_HOSTS=http://efk-elasticsearch-client.kube-system.svc.cluster.local:9200 \
--set fluent-bit.enabled=true \
--set logstash.enabled=false
export function TodoView() {
const state = useState<State>(State.PENDING)
const handleCreateTask(e: React.SyntheticEvent) {
// TODO
}
return <div>
<ol>
{tasks.map((task) => <Task task={task} />)}
import { action, observable } from 'mobx'
import { observer } from 'mobx-react'
import React, { useContext } from 'react'
class CounterViewModel {
@observable count: number = 0
@action.bound public plus() {
this.count++
}
image: java:8-jdk
stages:
- test
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
@wickedev
wickedev / SpringCoroutineApp.kt
Last active August 21, 2020 14:08
Spring Webflux + Kotlin Coroutine + Spring Data R2DBC
package com.spring.coroutine
import io.r2dbc.spi.ConnectionFactory
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.context.support.beans
import org.springframework.core.io.ClassPathResource
import org.springframework.data.annotation.Id
import org.springframework.data.r2dbc.connectionfactory.init.CompositeDatabasePopulator
import org.springframework.data.r2dbc.connectionfactory.init.ConnectionFactoryInitializer
/**
output:
main run in [ main ]
fetchData run in [ DefaultDispatcher-worker-1 ]
runApplication run in [ main ] result: [ Hello Coroutine ]
*/
import kotlinx.coroutines.*
fun main() = runBlocking {