Skip to content

Instantly share code, notes, and snippets.

View 1ambda's full-sized avatar
🦁
in the jungle

Kun 1ambda

🦁
in the jungle
View GitHub Profile
dfConverted3 = dfConverted1\
.selectExpr("*",
f"CASE WHEN education == '{educationInvalid}' THEN '{educationDefault}' ELSE education END as education"
)
@leoh0
leoh0 / README.md
Last active September 15, 2022 00:43
containerd를 이용해서 standalone kubelet 사용하기

standalone-kubelet-with-containerd.md

가끔 kubernetes 같은건 너무 무거워서 단일 호스트에 docker만 띄워서 운영하는 경우같은걸 고민 하게 됩니다. 하지만 그냥 docker만 가지고 사용하면 컨테이너가 죽었을때 관리해 줘야 하는 불편함과 같이 기능을 보다 더 필요로 하게 됩니다. 그래서 이 방법을 소개해 드립니다.

이건 standalone kubelet 이라고 불리는 master 없이 node만 관리해주는 kubelet을 이용해서 container를 관리하는 방법입니다. 이건 k8s 초기 부터 원래 존재했던 컨셉이나 많이 알려져 있지 않아서 모르시는 분들이 많아서 이글을 작성해 봤습니다.

이 방법을 이용하면 실제 master 없이 kubelet 만으로 서비스를 할 수 있습니다. 컨테이너 자동 재시작, port forwarding, resource limit 등 기본적인 kubelet에서 제공하는 다양한 방법으로 컨테이너들을 관리 할 수 있습니다.

@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
@slikts
slikts / context-vs-redux-2020.md
Last active March 6, 2022 20:41
Up to date answer about when to use React context or Redux (Redux Toolkit)

nelabs.dev

React context vs Redux in 2020

The [React docs][condoc] give some example use cases for context:

Context is designed to share data that can be considered “global” for a tree of React components, such as the current authenticated user, theme, or preferred language.

The common property of these use cases is that data like the current theme doesn't change often and needs to be shared deep down the component tree, which would be cumbersome with "[prop drilling][drill]". Something else that needs to be shared everywhere is the application state when using a "single source of truth" pattern, so it would follow that the context API would help with that as well, but there's a catch: components that use context will rerender every time that the provided value changes, so sharing the whole application state through context would cause excessive render lifecycles.

@yhatt
yhatt / marp.md
Last active April 22, 2024 17:00
Marp Next example
marp

Marp

h:250

Markdown presentation ecosystem
@ninanung
ninanung / ReactHooks1.md
Last active May 17, 2020 09:19
때늦은 React Hooks 시리즈 1탄 - 개요/useState

이 글의 코드는 저자의 Github에서 확인할 수 있습니다.

때늦은 React Hooks 시리즈 1탄 - 개요/useState

나온지가 언제인데 지금에서야 이걸...?

그건 제가 이제서야 이걸 알았기 때문입니다. 늦게라도 알았으니 시작해야죠 별수 있나요.

개요

@chendo
chendo / _document.js
Last active June 2, 2022 02:54
Server side rendering (SSR) in Next.js with styled-components, styled-jsx, and emotion.
import Document, { Head, Main, NextScript } from 'next/document'
import { renderToString } from 'react-dom/server'
import { extractCritical } from 'emotion-server'
import { ServerStyleSheet } from 'styled-components'
import flush from 'styled-jsx/server'
export default class MyDocument extends Document {
static async getInitialProps(ctx) {
const styledComponentsSheet = new ServerStyleSheet()
@SehoNoh
SehoNoh / fixed-aws-kinesis-agent-setup
Created January 15, 2019 12:55
Bugfix aws kinesis agent setup script
#! /usr/bin/env bash
# If we have an error, bail out!
set -e
# If we're debugging, be really loudly verbose
[[ ! -z $DEBUG ]] && set -x
# Attempt to load up the /etc/lsb-release file to determine our OS. If none is
# found, we default our settings to RHEL/Amazon Linux as the original behavior
@neerfri
neerfri / gist:4bd7477920cb33a2a229807ed10c29c2
Created September 6, 2018 08:32
k8s cluster autoscaler command line options
$ docker run k8s.gcr.io/cluster-autoscaler:v1.2.2 /cluster-autoscaler -h
Usage of /cluster-autoscaler:
pflag: help requested
--address string The address to expose prometheus metrics. (default ":8085")
--alsologtostderr log to standard error as well as files
--application-metrics-count-limit int Max number of application metrics to store (per container) (default 100)
--azure-container-registry-config string Path to the file containing Azure container registry configuration information.
--balance-similar-node-groups Detect similar node groups and balance the number of nodes between them
--boot-id-file string Comma-separated list of files to check for boot-id. Use the first one that exists. (default "/proc/sys/kernel/random/boot_id"
@whoisryosuke
whoisryosuke / nextjs-hoc-authorization.js
Created June 26, 2018 22:24
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side