Skip to content

Instantly share code, notes, and snippets.

View kaenova's full-sized avatar
👋
Balo!

Kaenova Mahendra Auditama kaenova

👋
Balo!
View GitHub Profile
@kaenova
kaenova / QuickSort.py
Last active April 3, 2021 14:07
A Quicksort Algorithm in Python
def quicksort(lst, sort='asc'):
#Use 'asc' for ascending sort
#Use 'dsc' for descending sort
if (len(lst) == 1):
return lst
elif (len(lst) == 2):
if sort == 'asc':
if lst[0] >lst[1]:
lst[0], lst[1] = lst[1], lst[0]
return lst
- All about Docker -
Installing Docker on Ubuntu
https://docs.docker.com/engine/install/ubuntu/
How to deploy a docker container with interactive bash?
$ docker run -d -t --hostname [Nama Hostnya / PCnya] --name [Name of the container] [docker container]
How to see deployed container?
$ docker container ls
- All about Kubernetes -
You need to install docker, kubernete or minikube(only runs on local), and kubectl
Node is a machine (it can be a baremetal computer or a VM)
Pod is a container that contain a "docker container"
Creating pods
$ kubectl create -f [yaml file]
See running pods
@kaenova
kaenova / kFoldList.py
Last active June 2, 2021 06:32
K-Fold from a List Implementation in Python
def kFold(list, totalFold):
# Pre-requisite check
if totalFold > len(list):
raise Exception("TotalFold can't be more than total element in the list")
# Variable initialization
fold = []
current_element = 0
element_per_fold = len(list) // totalFold
modulus_counter = len(list) % totalFold
@kaenova
kaenova / TextCleaning.py
Created August 20, 2021 04:29
Indonesian Text Cleaning with Sastrawi Library
import pandas as pd
import re
import string
from tqdm import tqdm
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
class DataCleaning:
# Initialization
factory = StemmerFactory()
stemmer = factory.create_stemmer()
# Membagi 'a' menjadi 'b' bagian
a = [1,2,3,4,5,6,7,8,9,10,11]
b = 3
new_arr = []
for i in range(b):
if i == 0:
new_arr.append(a[:(i+1)*(int(np.ceil(len(a)/b)))])
else:
@kaenova
kaenova / IMAGE UPLOAD ON COMMENT FIELD.txt
Created May 22, 2022 13:40
IMAGE UPLOAD ON COMMENT FIELD
IMAGE UPLOAD ON COMMENT FIELD
@kaenova
kaenova / K3s notes.md
Created July 7, 2022 10:10
Install K3s without Traefik

How to install K3s without built in traefik?

# source: https://www.suse.com/support/kb/doc/?id=000020082
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--no-deploy traefik" sh -s -
@kaenova
kaenova / Recursion component on creating heading.tsx
Last active February 19, 2023 10:07
Recursion Components with Callback function
// These are custom component, you can change it to your liking
import MainButton from '@/components/button/MainButton';
import InputText from '@/components/input/InputText';
import React, { useEffect, useState } from 'react';
function Test() {
return (
<div className="flex flex-col w-screen h-screen items-center justify-center">
<div className="w-5/12 rounded-md p-3 border border-neutral-500/20 shadow-md bg-white">
<Headers onChange={(data) => console.log(data)} />
@kaenova
kaenova / python proto.sh
Created September 23, 2023 04:47
Python Compile protoc
# For compiling to c
python -m grpc_tools.protoc \
-I./proto \
--python_out=./py-script/rpc \
--pyi_out=./py-script/rpc \
--grpc_python_out=./py-script/rpc \
./proto/*.proto
# For changing into relative import
sed -i 's/import \(\w\+\)_pb2 as \(\w\+\)__pb2/from . import \1_pb2 as \2__pb2/' \
py-script/rpc/*_grpc.py