Skip to content

Instantly share code, notes, and snippets.

View mustafatoker's full-sized avatar
🎯
Focusing

Mustafa TOKER mustafatoker

🎯
Focusing
View GitHub Profile
@aoudiamoncef
aoudiamoncef / README.md
Last active April 9, 2025 17:02
Spring Boot Logback Async Logging

Spring Boot Logback Async Logging

Overview

This gist demonstrates configuring asynchronous logging with Logback in a Spring Boot application. This approach provides improved performance, reduced latency, scalability, and fault tolerance.

By leveraging existing Spring logging configuration properties, we can customize the logging behavior according to your application's requirements seamlessly based on the envirement variables declared in defaults.xml. See Custom log configuration

Important

Contrary to the default configuration, file logging (ASYNC_FILE) is enabled even if logging.file.name or logging.file.path are not used.

@murdercode
murdercode / laravel-fastcgi-cache-config.md
Last active July 3, 2024 10:19
Optimizing Laravel (and Nova) with FastCGI Cache Configuration

Laravel + FastCGI Cache = ❤️

⚠️ Need a more specific guide? See https://medium.com/@murdercode/speed-up-your-laravel-application-up-to-1000x-with-fastcgi-cache-0135b11407e5

Using FastCGI cache allows you to speed up your website up to 1000x. In fact, the FastCGI cache (or Varnish) mechanism consists of putting a server-caching mechanism between a client and your web server. The whole page will be cached as an HTML output, and it will be delivered instead of using the PHP/MySQL/Redis stack, etc. for all users, but only for the first visit (and others after some specified time).

WARNING: This is not a take-away how-to. Please read it carefully and use it at your own risk.

This config is based on the ploi.io stack. We will not cover the FastCGI installation process, so please prepare FastCGI and adapt the next config if you need it.

<?php
namespace App\Http\Middleware;
use Closure;
class SanctumAbilities
{
/**
* Handle an incoming request.
@IvanChepurnyi
IvanChepurnyi / JIT results
Last active April 29, 2021 12:33
Benchmark HTTP service
wrk -c 500 -d 30s -t 12 -R 20k -L http://localhost:8888
Running 30s test @ http://localhost:8888
12 threads and 500 connections
Thread calibration: mean lat.: 456.139ms, rate sampling interval: 3485ms
Thread calibration: mean lat.: 458.787ms, rate sampling interval: 3125ms
Thread calibration: mean lat.: 294.161ms, rate sampling interval: 1654ms
Thread calibration: mean lat.: 391.126ms, rate sampling interval: 3123ms
Thread calibration: mean lat.: 325.404ms, rate sampling interval: 2699ms
Thread calibration: mean lat.: 359.069ms, rate sampling interval: 2533ms
Thread calibration: mean lat.: 72.867ms, rate sampling interval: 222ms
@smitpatel
smitpatel / MultiLevelIncludeQueries.cs
Last active October 15, 2021 17:39
This app shows how to do split queries for multiple levels of collection include in EF Core 3.0
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace EFSampleApp
{
public class Program
{
public static void Main(string[] args)
@brkfun
brkfun / helper.php
Last active September 19, 2019 08:45
Laravel get real query helper function
# Indeed you have to send builder to get bindings included to your query to make you to see real query goes to your database.
# Not much powerful it is just for seeing a singular query which is not working well that if you think
# write this function down to your helper(s).php
if(!function_exists('getRealQuery')){
function getRealQuery(\Illuminate\Database\Eloquent\Builder $query, $dumpIt = false)
{
$params = [];
@pavankjadda
pavankjadda / Serve Custom static resource locations in Spring Boot.md
Last active November 16, 2021 00:13
Serve Custom static resource locations in Spring Boot

Configure Spring Boot Application to serve Custom Static Resource locations

Static resources can be configured using two approaches in Spring Boot

  • Add custom path in application.properties/application.yaml
  • Implement WebMvcConfigurer addResourceHandlers() method

First configure your SpringSecurity class to accept requests to this resources

@Override
public void configure(WebSecurity web)
@paragtokopedia
paragtokopedia / query_builder.go
Last active January 6, 2024 18:37
Query Builder
package query_builder
import (
"strings"
"strconv"
"html/template"
"fmt"
)
type DynamicQueryBuilder string
@harryfinn
harryfinn / security.ubuntu.com-timeout-on-apt-get-update.md
Last active October 15, 2024 01:56
security.ubuntu.com timeout on apt-get update

security.ubuntu.com timeout on apt-get update

Issue

When running the apt-get update command, the process 'hangs' when checking security.ubuntu.com endpoints. This is apparantely due to an issue some sites face when trying to connect over IPv6 and whilst it is assumed that this will be fixed at some point in the future (sooner rather than later judging by the transition to IPv6 by most), the fix below resolves this issue, allowing the update process to complete successfully.

Fix

@bowmanmike
bowmanmike / dynamic_function_calls.go
Created February 22, 2017 19:06
Golang Dynamic Function Calling
package main
import (
"fmt"
)
// Use map[string]interface{} to pair functions to name
// Could maybe use anonymous functions instead. Might be clean
// in certain cases
var funcMap = map[string]interface{}{