Skip to content

Instantly share code, notes, and snippets.

View iampato's full-sized avatar
🖐️
Hey

Patrick waweru iampato

🖐️
Hey
View GitHub Profile
@iampato
iampato / main.sh
Created July 12, 2024 11:27
Delete and completely removing minikube
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes

JWT + OPENAPI

Setting up jwt api things:

const options = new DocumentBuilder()
    .setTitle('My App')
    .setSchemes('https')
    .setDescription('My App API documentation')
    .setVersion('1.0')
 .addBearerAuth()
@iampato
iampato / main.md
Created May 7, 2024 10:39
traefik ebs

Here are two approaches to achieve your goal:

  1. LoadBalancer Service with Traefik:

Create a LoadBalancer Service: Define a LoadBalancer service in your Kubernetes manifest for your Traefik deployment. This service automatically provisions an AWS Elastic Load Balancer (ELB). Configure Traefik Ingress: Create an Ingress resource that points to your Traefik service. This tells Traefik to route incoming traffic based on the defined rules. External Access: The ELB gets a public DNS name. You can use this DNS name to access your application externally. 2. NodePort Service with Traefik (Limited Use Case):

Note: This approach is generally not recommended for production due to security concerns and managing individual node IPs.

@iampato
iampato / main.sh
Created February 29, 2024 18:11
Installed Build Tools revision 34.0.0 is corrupted
cd ~/Library/Android/sdk/build-tools/34.0.0 && cp d8 dx && cd lib && cp d8.jar dx.jar
@iampato
iampato / main.ts
Created February 14, 2024 14:12
Function to generate code similar to MPESA transaction codes e.g RCE7QMM2G9, SAO9X7099B
// Generate voucher number
// using mpesa transaction reference format -> YYMMDDHHmmssNNNN
export function generateVoucherNumber(): string {
const now = new Date();
const yearMap = {
'20': 'A',
'21': 'B',
'22': 'C',
'23': 'D',
'24': 'E',
@iampato
iampato / Dockerfile
Created January 31, 2024 18:44 — forked from MillerAdulu/Dockerfile
Minimal Flutter Web Docker Deployment
# Install Operating system and dependencies
FROM ubuntu:22.04 as build-env
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback python3
RUN apt-get clean
ENV DEBIAN_FRONTEND=dialog
@iampato
iampato / use-color-mode.hooks.tsx
Last active January 16, 2024 08:49
Reactive color mode in React using hooks
import { useEffect } from 'react';
import useLocalStorage from './use-local-storage.hooks';
const useColorMode = () => {
const [colorMode, setColorMode] = useLocalStorage('color-theme', 'light');
useEffect(() => {
const className = 'dark';
const bodyClass = window.document.body.classList;
@iampato
iampato / httpClient.ts
Last active September 26, 2023 08:37
Custom axios http client
/*
* Copyright (c) 2023
* All rights reserved. @Patrick Waweru
*/
import axios, {AxiosInstance, AxiosRequestConfig, AxiosResponse} from 'axios';
import {destory, getAccessToken} from './SharePreference';
import {AppConstants} from './Constants';
export class HttpClient {
private axiosInstance?: AxiosInstance;
@iampato
iampato / main.tsx
Created September 18, 2023 21:44
Unintentionally I have created my own carousel that can extended to meet your needs
const images = [
"https:/...",
"https:/...",
"https:/...",
];
const Carousel = () => {
const [index,setIndex] = useState(0);
const goToNextSlide = () => {
@iampato
iampato / bash.sh
Created September 4, 2023 17:13
Alternative of installing protoc on Mac (brew failed)
PROTOC_ZIP=protoc-3.14.0-osx-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP