Skip to content

Instantly share code, notes, and snippets.

View alexcpn's full-sized avatar

Alex Punnen alexcpn

View GitHub Profile
@alexcpn
alexcpn / Input_ssylog.csv
Last active May 4, 2022 11:24
TFIDF Rank
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Mar 31 09:31:48 1freeipa-f476c9ffb-8gtc4 ns-slapd[2762]: [31/Mar/2022:09:31:48.659318010 +0000] DSRetroclPlugin - delete_changerecord: could not delete change record 11855 (rc: 32)
Mar 31 09:31:48 2freeipa-f476c9ffb-8gtc4 ns-slapd[2762]: [31/Mar/2022:09:31:48.751333697 +0000] DSRetroclPlugin - delete_changerecord: could not delete change record 11856 (rc: 32)
3DDDDfreeipa-f476c9ffb-8gtc4 ns-slapd[2762]: [31/Mar/2022:09:31:49.888424524 +0000] DSRetroclPlugin - delete_changerecord: could not delete change record 11864 (rc: 32)
Mar 31 09:31:48 4freeipa-f476c9ffb-8gtc4 ns-slapd[2762]: [31/Mar/2022:09:31:48.783381048 +0000] DSRetroclPlugin - delete_changerecord: could not delete change record 11857 (rc: 32)
Mar 31 09:31:48 5freeipa-f476c9ffb-8gtc4 ns-slapd[2762]: [31/Mar/2022:09:31:48.826483871 +0000] DSRetroclPlugin - delete_changerecord: could not delete change record 11858 (rc: 32)
Mar 31 09:31:49 freeipa-f476c9ffb-8gtc4 ns-slapd[2762]: [31/Mar/2022:09:31:49.156622971 +0000] DSRetroclPlugin - de
@alexcpn
alexcpn / tfidf_vectorizer .py
Created April 28, 2022 10:54
TFID Vectorizer
# Using TFidfVectorizer
# https://melaniewalsh.github.io/Intro-Cultural-Analytics/05-Text-Analysis/03-TF-IDF-Scikit-Learn.html
tfidf_vectorizer = TfidfVectorizer(token_pattern=u'(?ui)\\b\\w*[a-z]+\\w*\\b',stop_words='english') #token_pattern=u'(?ui)\\b\\w*[a-z]+\\w*\\b'
df = read_syslog(sys.argv[1])
tfidf_vector = tfidf_vectorizer.fit_transform(df['y_org'])
print(tfidf_vectorizer.get_feature_names_out())
tfidf_df = pd.DataFrame(tfidf_vector.toarray(), index=df['ds_org'], columns=tfidf_vectorizer.get_feature_names())
# Create a new row with sum of all the terms of the existing rows
tfidf_df.loc['00_Document Frequency'] = (tfidf_df > 0).sum()
```
^Croot@balamurugan-VirtualBox:~# kubectl logs rook-ceph-osd-8-ccb58986d-5bm22 -n rook-ceph -f
debug 2022-04-13T08:55:05.330+0000 7f580cf7af40 0 set uid:gid to 167:167 (ceph:ceph)
debug 2022-04-13T08:55:05.330+0000 7f580cf7af40 0 ceph version 15.2.4 (7447c15c6ff58d7fce91843b705a268a1917325c) octopus (stable), process ceph-osd, pid 1
debug 2022-04-13T08:55:05.330+0000 7f580cf7af40 0 pidfile_write: ignore empty --pid-file
debug 2022-04-13T08:55:05.331+0000 7f580cf7af40 1 bdev create path /var/lib/ceph/osd/ceph-8/block type kernel
debug 2022-04-13T08:55:05.331+0000 7f580cf7af40 1 bdev(0x56533512c000 /var/lib/ceph/osd/ceph-8/block) open path /var/lib/ceph/osd/ceph-8/block
debug 2022-04-13T08:55:05.331+0000 7f580cf7af40 -1 bdev(0x56533512c000 /var/lib/ceph/osd/ceph-8/block) _aio_start io_setup(2) failed with EAGAIN; try increasing /proc/sys/fs/aio-max-nr
debug 2022-04-13T08:55:05.332+0000 7f580cf7af40 0 starting osd.8 osd_data /var/lib/ceph/osd/ceph-8 /var/lib/ceph/osd/ceph-8/journal
debug 2022-04-13T08:55:05.3
@alexcpn
alexcpn / README.md
Last active September 11, 2025 03:30
Prophet for Anomaly detection

Note: Region of Bucket and Data should be same

BigQuery ML Model - CREATE or REPLACE MODEL

CREATE OR REPLACE MODEL `computervision-159307.test.logistic_model` OPTIONS(model_type='LOGISTIC_REG',
    input_label_cols=['output']) AS
SELECT
  age,
 cp,
@alexcpn
alexcpn / softmax.py
Created January 28, 2022 14:34
The derivative of softmax
def softmax(x):
"""Compute softmax values for each sets of scores in x.
why the max - see Eli's post https://eli.thegreenplace.net/2016/the-softmax-function-and-its-derivative/
"""
e_x = np.exp(x - np.max(x)) #
return e_x / e_x.sum()
def derv_softmax(s): # where x is the input
"""
@alexcpn
alexcpn / clear-vol.sh
Created January 19, 2022 12:22
Delete pod volume mapping for terminated pods
#!/bin/bash
KUBELET_HOME=/var/lib
for podid in 05156637-1f26-4437-a0ea-3b60062c454a;
do
if [ ! -d ${KUBELET_HOME}/kubelet/pods/$podid ]; then
break
fi
@alexcpn
alexcpn / cnn_python.py
Created December 21, 2021 15:25
CNN Part in Python
def conv2d(self, image, filter):
imagesize = image.shape
filter_size = filter.shape
print(imagesize)
i = imagesize[0]
j = imagesize[1]
k = imagesize[2]
fl = filter_size[0] # filter length of row
print("Image=", i, j, k, "Filter=", fl)
di = -1
@alexcpn
alexcpn / rook-ceph-external_v1.5.md
Last active August 30, 2023 18:54
Rook-Ceph v1.5 with External Ceph Cluster

Please follow the steps as is for correct installation

Step 1: Install Rook

We are taking from version v1.5.10. The latest v1.6.1 has a bug for external Ceph (git clone --single-branch --branch v1.5.10 https://github.com/rook/rook.git)

kubectl create -f rookv1.5.10/operator/crds.yaml
@alexcpn
alexcpn / systemd-in-container.md
Last active May 7, 2025 22:50
Running systemd inside a Container

Running systemd inside a Container

Some context here - https://developers.redhat.com/blog/2019/04/24/how-to-run-systemd-in-a-container

With Docker you need to mount the host volume -v /sys/fs/cgroup:/sys/fs/cgroup:ro However this is not needed for podman

If Kubernetes cluster is still using Docker, this will not work in pod wihtout these mounts; but if using Containerd directly (kubelet--> Containerd-->runc) I am not sure