Skip to content

Instantly share code, notes, and snippets.

View 40a's full-sized avatar

40a

View GitHub Profile
@40a
40a / mp3-upload-direct-link.md
Created October 2, 2023 21:19 — forked from Moutard3/mp3-upload-direct-link.md
Tutorials / Walkthrough for uploading & getting direct link of sound file (mp3, ogg, ...)
@40a
40a / tuning_nginx_nodejs
Created January 9, 2021 09:54 — forked from carlessistare/tuning_nginx_nodejs
Tuning Nginx for heavy loading with nodejs as upstream. Short requests and a lot of concurrence.
# This number should be, at maximum, the number of CPU cores on your system.
# (since nginx doesn't benefit from more than one worker per CPU.)
worker_processes 8;
# Determines how many clients will be served by each worker process.
# (Max clients = worker_connections * worker_processes)
# "Max clients" is also limited by the number of socket connections available on the system (~64k)
# run ss -s and u'll see a timewait param
# The reason for TIMED_WAIT is to handle the case of packets arriving after the socket is closed.
@40a
40a / wsl2-network.ps1
Created November 19, 2020 11:43 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@40a
40a / README.md
Created September 28, 2020 12:56 — forked from alexanderilyin/README.md
Auto-increment Minor Semantic Version using Docker Hub API v2

For example your latest image with semantic versioning looks like this:

${DOCKER_HUB_ORG}/${DOCKER_HUB_REPO}:v1.20.0

Example provided above will do the folowing:

  1. Generate token using your github username and password.
  2. Get list of all tags from repository.
@40a
40a / custom.scss
Created July 13, 2020 08:29 — forked from ToniWonKanobi/custom.scss
Custom Stylesheet for Desktop Safari
// Variables
// Color for <code> and <pre>
$lighterGray: lighten(black, 25%);
// Background color for <code>
$lightGray: lighten(lightgray, 10%);
// Border color for <pre> and <code>
$darkGray: darken(lightgray, 3%);
// Background color of YouTube
$darkerGray: darken(gray, 35%);
data_dir = "/var/lib/vector"
# ------------------ SYSLOG message pipe ------------------ #
[sources.syslog_pipe_in]
type = "socket"
mode = "udp"
address = "127.0.0.1:3333"
[transforms.syslog_pipe_parsing]
@40a
40a / README.md
Created January 6, 2020 10:52 — forked from WoZ/README.md
Strace reads and writes analyzer

Usage: node strace_log_analyzer.js strace.log /tmp

This scripts parses input file that must contain strace log from a single thread. Then script calculates:

  • execution time of read/write syscall for each file descriptor and summarize execution time for each 1 sec period,
  • calulates amount of read/write syscalls for each file descriptor

strace log must be collcted with -t -T -f options.

Function New-PSWebServer {
<#
.Synopsis
Creates a web server that will invoke PowerShell code based on routes being asked for by the client.
.Description
New-PSWebServer creates a web server. The web server is composed of a schema that defines the client's requests to routes where PowerShell code is executed.
Under the covers, New-PSWebServer uses the HTTPListener .NET class to execute powershell code as requested, retrieves the results and sends data back through the httplistener web server framework.
@40a
40a / build.gradle.kts
Created November 4, 2019 06:20 — forked from whyoleg/build.gradle.kts
JOOQ with flyway and gradle
import com.opentable.db.postgres.embedded.*
import org.flywaydb.core.*
import org.jooq.codegen.*
tasks.named("compileKotlin") {
doFirst {
//create embedded postgresql
EmbeddedPostgres.builder().setPort(5400).start().use {
//migrate embedded posrtgresql
Flyway.configure()
@40a
40a / Query-Registry.ps1
Created October 25, 2019 07:31 — forked from so0k/Query-Registry.ps1
Query a docker registry v2/_catalog endpoint from powershell
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
$Filter=".*",
#TODO: handle https & no basic auth as well..
$RegistryEndpoint = "registry.mysite.com",
$UserName = "user",
$Password = "password"
)