Skip to content

Instantly share code, notes, and snippets.

View erhwenkuo's full-sized avatar

ErhWen Kuo erhwenkuo

View GitHub Profile
@erhwenkuo
erhwenkuo / cuda_11.8_installation_on_Ubuntu_22.04
Last active September 1, 2023 01:04 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@erhwenkuo
erhwenkuo / 01_deployment.yaml
Created April 15, 2019 22:29
Kubernetes Ingress & Ingress Controller 範例#1 (app1)
apiVersion: apps/v1
kind: Deployment
metadata:
name: app1-deployment
namespace: default
labels:
app: app1
spec:
replicas: 3
selector:
@erhwenkuo
erhwenkuo / 01_deployment_testweb.yaml
Created April 14, 2019 04:16
Kubernetes網路是如何運作?Part#3 (Ingress & Ingress Controller)
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: test-web-deployment
namespace: default
labels:
app: test-web
spec:
replicas: 3
selector:
@erhwenkuo
erhwenkuo / ds01_AdminClient_describe_cg_info2.java
Created November 9, 2018 06:31
使用Kafka的AdminClient API來查詢Kafka中特定ConsumerGroup的offset
import org.apache.kafka.clients.admin.*;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.TopicPartition;
import java.util.*;
import java.util.concurrent.ExecutionException;
/**
* Kafka的AdminClient函式庫,支持管理和檢查topics, brokers, configurations和ACLs。
@erhwenkuo
erhwenkuo / ds01_AdminClient_describe_cg_info.java
Last active June 8, 2022 06:55
使用Kafka的AdminClient API來查詢Kafka中每一個ConsumerGroup己經消費過的offset最大值
import org.apache.kafka.clients.admin.*;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.TopicPartition;
import java.util.*;
import java.util.concurrent.ExecutionException;
/**
* Kafka的AdminClient函式庫,支持管理和檢查topics, brokers, configurations和ACLs。
* 所需的最小的Kafka broker版本為0.10.0.0。有些API會需要更高版本的Kafka broker的話會註解在API中。
@erhwenkuo
erhwenkuo / ds01_AdminClient_delete_topics.java
Created November 4, 2018 02:32
使用Kafka的AdminClient API來刪除Kafka Topic
import org.apache.kafka.clients.admin.*;
import org.apache.kafka.common.KafkaFuture;
import org.apache.kafka.common.errors.UnknownTopicOrPartitionException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
@erhwenkuo
erhwenkuo / ds01_AdminClient_describe_topics.java
Last active July 6, 2021 03:55
使用Kafka的AdminClient API來查詢Kafka Topic的meta data
import org.apache.kafka.clients.admin.*;
import org.apache.kafka.common.Node;
import org.apache.kafka.common.TopicPartitionInfo;
import java.util.*;
import java.util.concurrent.ExecutionException;
/**
* Kafka的AdminClient函式庫,支持管理和檢查topics, brokers, configurations和ACLs。
* 所需的最小的Kafka broker版本為0.10.0.0。有些API會需要更高版本的Kafka broker的話會註解在API中。
*/
@erhwenkuo
erhwenkuo / ds01_AdminClient_create_topics.java
Last active November 4, 2018 02:29
使用Kafka的AdminClient API來創建新的Kafka Topic
import org.apache.kafka.clients.admin.*;
import org.apache.kafka.common.KafkaFuture;
import org.apache.kafka.common.Node;
import java.util.*;
import java.util.concurrent.ExecutionException;
/**
* Kafka的AdminClient函式庫,支持管理和檢查topics, brokers, configurations和ACLs。
* 所需的最小的Kafka broker版本為0.10.0.0。有些API會需要更高版本的Kafka broker的話會註解在API中。
@erhwenkuo
erhwenkuo / ds01_AdminClient_cluster_info.java
Last active November 4, 2018 02:29
使用Kafka的AdminClient API來查詢Kafka叢集的基本資料
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.DescribeClusterResult;
import org.apache.kafka.clients.admin.KafkaAdminClient;
import org.apache.kafka.common.Node;
import java.util.Collection;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
/**
* Kafka的AdminClient函式庫,支持管理和檢查topics, brokers, configurations和ACLs。
@erhwenkuo
erhwenkuo / docker-compose.yml
Created August 13, 2018 08:16
ak-training-env-docker
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.0.0
hostname: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181