Skip to content

Instantly share code, notes, and snippets.

@Ima8
Ima8 / CodeMonk_Part#Man.sql
Created July 25, 2021 13:58 — forked from CodMonk/CodeMonk_Part#Man.sql
MySQL Stored Procedure for Table Partitioning
CREATE DEFINER=`root`@`localhost` PROCEDURE `Cmonk_partition_manager`(in partition_frequency varchar(100), in db_schema varchar(100),in input_table_name varchar(100), in partition_column varchar(100))
BEGIN
-- Author - Code Monk
-- Version - 1.0
-- Procedure for automated partitioning of table
-- Inputs :
-- 1- Partition_frequency : Options-(Daily,Monthly,Weekly)
-- 2- db_schema : Name of Database schema
-- 3- input_table_name : Table Name
@Ima8
Ima8 / nginx-tuning.md
Created April 25, 2021 04:32 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

def recursive_dbscan(orders, min_radius, max_radius):
	while min_radius < max_radius:
		curr_radius = (min_radius+max_radius)/2
		
		clusters = DBSCAN(orders, curr_radius)
		
		if no_clusters < min_no_clusters: # not enough clusters
			max_radius = curr_radius-1
 else:
@Ima8
Ima8 / Dockerfile
Created October 11, 2019 03:37 — forked from hermanbanken/Dockerfile
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@Ima8
Ima8 / Dockerfile
Created October 11, 2019 03:37 — forked from mehyedes/Dockerfile
Compiling NGINX module as dynamic module for use in docker
FROM nginx:1.14.2 AS builder
LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>"
ENV NGINX_VERSION 1.14.2
ENV VTS_VERSION 0.1.18
COPY ./badproxy /etc/apt/apt.conf.d/99fixbadproxy
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
@Ima8
Ima8 / cut.js
Created July 18, 2019 09:51 — forked from dtinth/cut.js
Thai word cut in Chrome
// Note: Using non-standard V8 feature
// https://code.google.com/archive/p/v8-i18n/wikis/BreakIterator.wiki
//
// The standard is now Intl.Segmenter but no browser implements it yet.
//
function cut(text) {
const iterator = new Intl.v8BreakIterator(["th"]);
iterator.adoptText(text);
const result = [];
let pos = iterator.first();
@Ima8
Ima8 / kubernetes_commands.md
Created June 23, 2019 17:23 — forked from edsiper/kubernetes_commands.md
Kubernetes Useful Commands
@Ima8
Ima8 / w3c.conf
Created July 3, 2018 09:31 — forked from iCyLand/w3c.conf
W3C json log format for nginx
map $request_uri $request_uri_path {
"~^(?P<path>[^?]*)(\?.*)?$" $path;
}
log_format w3cjson escape=json
'{'
'"Date":"$time_iso8601",'
'"Client IP Address":"$remote_addr",'
'"Client Username":"$remote_user",'
'"Server IP Address":"$server_addr",'