Skip to content

Instantly share code, notes, and snippets.

View arjun921's full-sized avatar
🧠
Perpetual Learner

Arjun Sunil arjun921

🧠
Perpetual Learner
View GitHub Profile
@arjun921
arjun921 / hamming.md
Created April 22, 2024 10:14
Np.hamming implementation in Kotlin as FloatArray

User
np.hamming as a floatarray in Kotlin.

ChatGPT
You can implement the Hamming window function in Kotlin as a FloatArray like this:

fun hammingWindow(length: Int): FloatArray {
    val window = FloatArray(length)
 val alpha = 0.54f
@arjun921
arjun921 / confluent_kafka_python_lag.py
Created February 5, 2022 13:10
Get Confluent Kafka lag using Confluent Kafka Python Client
import multiprocessing
import os
import time
from confluent_kafka import Consumer, TopicPartition
import ccloud_lib
def get_partition_lag(partition: int):
import os
from datetime import datetime as dt
from pathlib import Path
yy = str(dt.now().year)
mm = str(dt.now().month)
dd = str(dt.now().day)
a = yy+mm+dd
work_dir_root = Path('<set your working directory/TIL local folder here>')
def caesarCipher(s, k):
"""
s -- input string
k -- rotate by k
"""
rotate = k
original_language = {}
rotated = {}
leng = len(string.ascii_lowercase)-1
if rotate>leng:
@arjun921
arjun921 / url_predict.py
Created September 13, 2020 15:56
Tensorflow 2.0 predict from image URL
import numpy as np
from tensorflow.keras.preprocessing import image
from tensorflow.keras.utils import get_file
img_url = 'paste-url-here'
random_string_for_file_name = 'test_image'
img = image.load_img(get_file(random_string_for_file_name,img_url),target_size=(150,150))
img_arr = image.img_to_array(img)
img_arr = np.expand_dims(img_arr, axis=0)
plugins:
- kind: KfAwsPlugin
metadata:
name: aws
spec:
auth:
oidc:
certArn: arn:aws:acm:us-west-2:########:certificate/#######-#####-###-#
oAuthClientId: Your Auth0 App Client Id
oAuthClientSecret: Your Auth0 App Client Secret
@arjun921
arjun921 / pod_completed_check.sh
Last active February 5, 2020 08:42
Await kubernetes pod status==Completed
#!/bin/bash
while [[ $(kubectl get pods $pod_name -o json | jq -r .status.containerStatuses[0].state.terminated.reason) != "Completed" ]]; do
echo "waiting for pod to finish docker build and push" && sleep 5
done
$ kubectl get svc --all-namespaces | grep LoadBalancer
ingress-nginx random-services-nginx-ingress-controller LoadBalancer 125.65.52.145 a2smioi173y7912bs6a-195942069.us-east-2.elb.amazonaws.com 80:30223/TCP,443:31030/TCP 19d
kubectl apply -f my-release-name/
kubectl apply -f my-release-name/