Skip to content

Instantly share code, notes, and snippets.

View pingkunga's full-sized avatar
🎯
Focusing

Chatri Ngambenchawong pingkunga

🎯
Focusing
View GitHub Profile
@pingkunga
pingkunga / handler.go
Created April 23, 2024 06:57
Golang Controller / Service / Repository with Postgres
package main
import (
"net/http"
"github.com/labstack/echo/v4"
)
type Handler struct {
service *Service
}
CREATE TABLE IF NOT EXISTS `wp_redirection_items` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`url` mediumtext NOT NULL,
`match_url` VARCHAR(2000) DEFAULT NULL,
`match_data` TEXT,
`regex` INT(11) unsigned NOT NULL DEFAULT '0',
`position` INT(11) unsigned NOT NULL DEFAULT '0',
`last_count` INT(10) unsigned NOT NULL DEFAULT '0',
`last_access` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
`group_id` INT(11) NOT NULL DEFAULT '0',
@pingkunga
pingkunga / DeepEqualsExtensions.cs
Created March 12, 2024 08:03
dotnet DeepEqualsExtensions
public static bool DeepEquals (this object obj, object another)
{
if (ReferenceEquals (obj, another)) return true;
if ((obj == null) || (another == null)) return false;
if (obj.GetType ()! = another.GetType ()) return false;
// If the property is not a class, just int, double, DateTime, etc. v
// Call regular equal function
if (! obj.GetType (). IsClass) return obj.Equals (another);
@pingkunga
pingkunga / docker-compose.yaml
Last active April 17, 2024 13:31
docker compose for PostgreSQL and PGAdmin
version: "3.8"
services:
db:
image: postgres
container_name: local_pgdb
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: your-username
@pingkunga
pingkunga / sampledotnettools.csproj
Created January 5, 2024 00:01
sampledotnettools.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackAsTool>True</PackAsTool>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<Version>1.0.1</Version>
</PropertyGroup>
@pingkunga
pingkunga / test_talos_nginx.yaml
Created December 30, 2023 09:13
test_talos_nginx.yaml
apiVersion: v1
kind: Namespace
metadata:
creationTimestamp: null
name: test-talos
spec: {}
status: {}
---
apiVersion: apps/v1
kind: Deployment
@pingkunga
pingkunga / config.river
Created December 11, 2023 08:51
GrafanaAgent
logging {
level = "debug"
format = "logfmt"
}
otelcol.receiver.otlp "example" {
http {
endpoint = "0.0.0.0:4318"
}
@pingkunga
pingkunga / testreadiness.yaml
Created November 19, 2023 02:45
Sample Simulate Readiness
apiVersion: apps/v1
kind: Deployment
metadata:
name: busybox-deployment
spec:
replicas: 1
selector:
matchLabels:
app: busybox
template:
@pingkunga
pingkunga / ุถามเพิ่ม
Created November 12, 2023 03:19
ุถามเพิ่มข้อ 4
ถามเพิ่ม สงสัยอันนี้
```
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: pingd
name: pingd
@pingkunga
pingkunga / metric-server.yaml
Created November 8, 2023 10:34
metric-server for K8S via docker-desktop 4.24.2
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: metrics-server
name: metrics-server
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole