Skip to content

Instantly share code, notes, and snippets.

Avatar
🌍

Mike Houngbadji mikekenneth

🌍
View GitHub Profile
@mikekenneth
mikekenneth / clean_dataframe_with_pandera_schema.py
Created Dec 14, 2021
Clean pandas dataframe using pandera validation. The returned dataframe is the result of droping non-valid records.
View clean_dataframe_with_pandera_schema.py
import pandas as pd
import pandera as pa
def clean_dataframe_with_schema(dataframe, schema):
try:
return schema.validate(dataframe)
except (pa.errors.SchemaErrors, pa.errors.SchemaError) as err:
return dataframe.drop(labels=err.failure_cases['index'].to_list())
View kafka_file_from_beginning.sh
#!/usr/bin/env bash
###########################################################################
##### $Author Mike Houngbadji (mike.kenneth47@gmail.com)
# $Description: data Real time Pipeline in kafka
# $History
# 20161009 @MIKE
###########################################################################
kafka_producer='$KAFKA_HOME/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test';
@mikekenneth
mikekenneth / gist_1.py
Last active Jun 25, 2021
Code: 3 Letters code from Surname
View gist_1.py
def get_surname_code(surname: str, fill_string='0') -> str:
seperators, i, pos = ("'", " ", "-"), 0, 0
for letter in surname:
i += 1
if letter in seperators:
pos = i
return surname[pos:pos+3].upper().ljust(3,fill_string)
# Example:
View fix-wsl2-dns-resolution
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@mikekenneth
mikekenneth / .gitignore
Created Jul 1, 2020 — forked from santoshpy/.gitignore
gitignore file for django project
View .gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
@mikekenneth
mikekenneth / Install NVIDIA Driver and CUDA.md
Created Nov 25, 2019 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
View Install NVIDIA Driver and CUDA.md
View Install Python 3.7.5 on CentOS 7
Install Python 3.7.5 on CentOS/RHEL 7
1.Requirements:
yum install gcc openssl-devel bzip2-devel libffi-devel
# Below requirement for djang projects
yum install readline-devel tk-devel tk-devel openssl-devel sqlite-devel openssl tk readline sqlite
2.Download Python 3.7: