Skip to content

Instantly share code, notes, and snippets.

View luqmansen's full-sized avatar
🎯
Focusing

Luqman luqmansen

🎯
Focusing
View GitHub Profile
mkdir -p k8s/cert/ && cd k8s/cert/
openssl req -nodes -newkey rsa:2048 -keyout dashboard.key -out dashboard.csr -subj "/C=/ST=/L=/O=/OU=/CN=*"
openssl x509 -req -sha256 -days 3650 -in dashboard.csr -signkey dashboard.key -out dashboard.crt
microk8s kubectl -n kube-system delete secret kubernetes-dashboard-certs
microk8s kubectl -n kube-system create secret generic kubernetes-dashboard-certs --from-file=dashboard.crt --from-file=dashboard.key
microk8s kubectl -n kube-system edit deploy kubernetes-dashboard -o yaml
# change args part
args:
@luqmansen
luqmansen / mime.types
Created April 29, 2021 17:44
Apache mime type
# This file maps Internet media types to unique file extension(s).
# Although created for httpd, this file is used by many software systems
# and has been placed in the public domain for unlimited redisribution.
#
# The table below contains both registered and (common) unregistered types.
# A type that has no unique extension can be ignored -- they are listed
# here to guide configurations toward known types and to make it easier to
# identify "new" types. File extensions are also commonly used to indicate
# content languages and encodings, so choose them carefully.
#
@luqmansen
luqmansen / main.go
Created June 3, 2021 14:56
stream stdout from long running asynchronous cmd
package main
import (
"bufio"
"fmt"
"os/exec"
"time"
)
func main() {
@luqmansen
luqmansen / main.go
Created May 23, 2021 15:21
Golang Make sure all goroutine function executed unless there is an error
package main
import (
"errors"
"fmt"
"log"
"os"
"strconv"
"sync"
"time"
import logging
import os
import pickle
from concurrent.futures import ThreadPoolExecutor
from os import path
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
@luqmansen
luqmansen / main.go
Created June 10, 2021 15:23
Exit a for loop using channel
package main
import (
"fmt"
"time"
)
func main() {
function2()
@luqmansen
luqmansen / docker-compose.yaml
Last active June 27, 2021 09:21
mysql docker compose
version: '3.1'
services:
db:
image: mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: morph
MYSQL_USER: mysql
@luqmansen
luqmansen / debugstruct.go
Created November 17, 2021 10:26
Debug Golang Struct
func debugStruct(d interface{}) {
s, _ := json.MarshalIndent(d, "", "\t")
fmt.Println(string(s))
}
@luqmansen
luqmansen / bench_test.go
Created July 21, 2022 03:39
Testing some concurrent map locking mechanism
package caskdb
import (
"github.com/cornelk/hashmap"
"math"
"sync"
"testing"
)
type m struct {
@luqmansen
luqmansen / conn_pool.py
Last active August 18, 2022 16:55
Simple Object Pool pattern to Create Connection Pool
from datetime import datetime
from multiprocessing import Lock
import mysql.connector
USER = "root"
PASSWD = "admin"
HOST = 'localhost'
DB = "db_test"