Skip to content

Instantly share code, notes, and snippets.

View wattanar's full-sized avatar

Wattana Ruengmucha wattanar

View GitHub Profile
@wattanar
wattanar / obervability.md
Last active November 5, 2024 10:15
obervability info

Observability is the practice of understanding the internal state of a system by analyzing its outputs—primarily logs, metrics, and traces. In software, observability provides insights into the health, performance, and behavior of applications, services, and infrastructure, allowing teams to identify and resolve issues faster, optimize system performance, and improve user experience.

Key Components of Observability

  1. Logs: Logs are records of events or messages generated by applications or infrastructure, often capturing errors, warnings, or significant operations. They help in understanding what actions occurred and in what sequence.

  2. Metrics: Metrics are numerical values that represent the performance of a system, such as CPU usage, memory usage, response times, and throughput. Metrics help monitor trends and spot anomalies.

  3. Traces: Traces follow a request’s path through different parts of the system, particularly in distributed or microservices architectures. They provide a deta

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Threading;
@wattanar
wattanar / Example.cshtml
Last active April 8, 2020 03:40
Razor Pages Snippets
@page
@model ExampleModel
@{
ViewData["Title"] = "Title";
}
<p class="text-success">@TempData["FormResultSuccess"]</p>
<p class="text-danger">@TempData["FormResultFailed"]</p>
@wattanar
wattanar / pdfcpu_example.md
Last active March 2, 2020 07:25
golang pdfcpu example command
@wattanar
wattanar / LICENCE SUBLIME TEXT
Created October 17, 2018 14:07
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@wattanar
wattanar / get_monday.php
Created February 12, 2018 01:33
[PHP] Get list of monday
<?php
function getMondaysInRange($dateFromString, $dateToString)
{
$dateFrom = new \DateTime($dateFromString);
$dateTo = new \DateTime($dateToString);
$dates = [];
if ($dateFrom > $dateTo) {
return $dates;
@wattanar
wattanar / dotnet-core-snippets.md
Last active October 31, 2017 14:51
.NET Core Snippets
  • Get files from directory
string[] filePaths = Directory.GetFiles(@"C:\path\to\file");

foreach (var item in filePaths)
{
    Console.WriteLine(item);
}
@wattanar
wattanar / mailkit_example.cs
Last active January 3, 2023 13:53
C# Send Email With MailKit
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
var message = new MimeMessage();
var bodyBuilder = new BodyBuilder();
// from
@wattanar
wattanar / .htaccess
Last active October 25, 2017 03:21
.htacess example
Options All -Indexes
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
@wattanar
wattanar / gh-pages-deploy.md
Created June 5, 2017 08:26 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).