Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

SeungTaeKim RyanKor

🎯
Focusing
View GitHub Profile
View Dockerfile
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install -y git python3
# ...
View pulumi_example.py
from pulumi import ResourceOptions
import pulumi_kubernetes as kubernetes
def get_object(dependencies):
return kubernetes.core.v1.PersistentVolumeClaim("pulumi에서 관리할 name지정",
kind="PersistentVolumeClaim",
api_version="v1",
metadata=kubernetes.meta.v1.ObjectMetaArgs(
namespace="k8s namespace",
name="pulumi에서 관리할 name지정",
@RyanKor
RyanKor / test_vb.py
Created Apr 19, 2022
vb code 테스트
View test_vb.py
import sys
sys.path.append('vb_code.py 경로 추가하거나, 동일 경로상에 두고 테스트 수행하기')
import vb
from struct import unpack
import random
from typing import List, TextIO
def test_vbc():
@RyanKor
RyanKor / vb_code.py
Created Apr 19, 2022
대규모 서비스를 지탱하는 기술 첫번째 과제
View vb_code.py
from struct import pack, unpack
from typing import List, TextIO
def encode_number(number: int) -> TextIO:
"""
VB Code Encode Number method
:param number:
:return:
Usage
View env_set.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import platform
%matplotlib inline
import matplotlib
import tensorflow as tf
BATCH_SIZE=6 # 커널이 계속 죽는다.. (메모리 초과...;) -> 배치 사이즈가 6보다 크면 메모리 초과 발생;
MAX_SEQ_LEN = 512
View neutron_test_tags.py
class TestReplaceNetwork(TestNetwork):
# The network to set.
_network = network_fakes.FakeNetwork.create_one_network(
{'tags': ['green', 'red']})
qos_policy = (network_fakes.FakeNetworkQosPolicy.
create_one_qos_policy(attrs={'id': _network.qos_policy_id}))
def setUp(self):
super(TestReplaceNetwork, self).setUp()
View neutron_tags.py
class ReplaceNetwork(common.NeutronCommandWithExtraArgs):
_description = _("Replace network properties")
def get_parser(self, prog_name):
parser = super(ReplaceNetwork, self).get_parser(prog_name)
parser.add_argument(
'network',
metavar="<network>",
help=_("Network to modify (name or ID)")
)
View test_uptime.py
class TestHypervisorUpTime(TestHypervisor):
def setUp(self):
super(TestHypervisorUpTime, self).setUp()
# Fake hypervisors to be listed up
self.hypervisor = compute_fakes.FakeHypervisor.create_one_hypervisor()
# Return value of utils.find_resource()
self.hypervisors_mock.get.return_value = self.hypervisor
View uptime.py
class UpTimeHypervisor(command.ShowOne):
_description = _("Display the uptime of the specified hypervisor.")
def get_parser(self, prog_name):
parser = super(UpTimeHypervisor, self).get_parser(prog_name)
parser.add_argument(
"hypervisor",
metavar="<hypervisor>",
help=_("Hypervisor to display (name or ID)")
)
View resnet50_cifar10.py
#!/usr/bin/env python
# coding: utf-8
import tensorflow as tf
import numpy as np
from tensorflow.keras.layers import Input, Add, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D, AveragePooling2D, MaxPooling2D, GlobalMaxPooling2D
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.initializers import random_uniform, glorot_uniform, constant, identity
from keras.utils import np_utils
get_ipython().run_line_magic('matplotlib', 'inline')