Skip to content

Instantly share code, notes, and snippets.

View sombochea's full-sized avatar

Sambo Chea sombochea

View GitHub Profile
@sombochea
sombochea / executor_concurrently.dart
Created February 16, 2024 05:55
A simple code for run with retry and concurrently in dart.
import 'dart:async';
import 'dart:collection';
FutureOr<T?> executeWithRetry<T>(
FutureOr<T?> Function() function, {
int maxRetries = 3,
int delayFactor = 2, // in seconds
throwIfFailed = true,
}) async {
int retries = 0;
package com.cubetiqs.rps.example;
import com.cubetiqs.sdk.rps.RpsClient;
import com.cubetiqs.sdk.shared.util.JsonUtil;
import com.cubetiqs.sdk.socketio.Utils;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.concurrent.TimeUnit;
/**
* @author sombochea
@sombochea
sombochea / Server.kt
Created May 12, 2022 08:33 — forked from Silverbaq/Server.kt
A simple socket-server written in Kotlin
package dk.im2b
import java.io.OutputStream
import java.net.ServerSocket
import java.net.Socket
import java.nio.charset.Charset
import java.util.*
import kotlin.concurrent.thread
@sombochea
sombochea / log4j_rce_detection.md
Last active December 11, 2021 01:54 — forked from Neo23x0/log4j_rce_detection.md
Log4j RCE CVE-2021-44228 Exploitation Detection

log4j RCE Exploitation Detection

You can use these commands and rules to search for exploitation attempts against log4j RCE vulnerability CVE-2021-44228

Grep / Zgrep

This command using for searches logs in nginx web server (access log)

cat /var/log/nginx/access.log | grep '${jndi:'
@sombochea
sombochea / ExampleController.java
Created December 18, 2020 11:16
SpringFox Swagger @AliasFor not working on @ApiOperation in Spring Boot
package com.example.mytest;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.builders.PathSelectors;
{
"template": {
"name": "My template 1",
"source": "<#list data.getData() as item> <h1>${item.name}</h1> </#list> <br /> ${title} - ${sock.mind.title}"
},
"dataSource": {
"type": "JSON",
"source": "[{\"name\": \"Sambo\"},{\"name\": \"Chea\"}]"
},
"options": {
@sombochea
sombochea / export.print.json
Last active October 14, 2020 02:28
Stock Import and Export for Print output (Internal only for CUBETIQ Software)
{
"configs": {
"title": "CUBETIQ Coperation Co,Ltd",
"headline": "Export Items",
"logoUrl": "https://visme.co/blog/wp-content/uploads/2017/08/40-Creative-Logo-Designs-to-Inspire-You-Movers-logo.jpg"
},
"data": {
"invoiceNumber": "INV00001",
"date": "13-10-2020",
"time": "10:30 AM",
@sombochea
sombochea / FactoryTests.kt
Last active October 13, 2020 05:39
Simple Factory Pattern on Kotlin
package com.cubetiqs.factory
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class FactoryTests {
@Test
fun factoryTest() {
val carA = CarFactory(CarType.CAR_A).getCar()
@sombochea
sombochea / vcl-regex-cheat-sheet
Created January 30, 2020 16:36 — forked from dimsemenov/vcl-regex-cheat-sheet
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"