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 / main.go
Created June 1, 2024 14:08
Test go-sqlite3 on windows
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/mattn/go-sqlite3"
)
@pingkunga
pingkunga / checkBranchName .groovy
Last active May 31, 2024 01:41
Check Branch Name match with pattern
/*
Regex to match branch name such as
origin/master >> match exactly
origin/master1 >> Not match
origin/develop >> match exactly
origin/develop1 >> Not match
origin/release8.8.17 >> match
@pingkunga
pingkunga / docker_update_command_sample.md
Created May 26, 2024 08:53
docker update command sample

Update a container’s cpu-shares

docker update --cpu-shares 512 abebf7571666

Update a container with cpu-shares and memory

docker update --cpu-shares 512 -m 300M abebf7571666 hopeful_morse

Update a new container’s kernel memory constraints

@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"
}