Skip to content

Instantly share code, notes, and snippets.

View kapb14's full-sized avatar
😤

Aleksandr Karushin kapb14

😤
View GitHub Profile
@kevin39
kevin39 / HAPROXY LDAP SETTINGS - WINDOWS COMPATIBLE
Last active March 14, 2022 21:29
HAProxy ldap-check compatible with Windows Server / Active Directory
# Note : Found somewhere on internet... Source lost
backend ldap_balancer
mode tcp
balance roundrobin
server SERVER_NAME SERVER_ADDR:389 maxconn 100 check
option tcpka
timeout server 2s
timeout connect 1s
# Below, ldap check procedure :
option tcp-check
@jtbonhomme
jtbonhomme / jira-behing-nginx-ssl
Created September 26, 2015 07:49 — forked from alertor/jira-behing-nginx-ssl
Atlassian JIRA behind nginx + SSL
# force HTTP to HTTPS - /etc/nginx/conf.d/nonssl.conf
server {
listen 80;
server_name jira.example.com;
access_log off;
return 301 https://$server_name$request_uri;
}
# /etc/nginx/conf.d/jira.conf
server {
@pavel-odintsov
pavel-odintsov / pps.sh
Last active August 27, 2023 20:21
Simple script to print packet rate for interface
#!/bin/bash
# Interval of calculation in seconds
INTERVAL="1"
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
user bitrix; #пользователь, под которым работает nginx. Желательно совпадение с пользователем apache
worker_processes 8; #8 одновременных процессов
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10240; #максимальное число открытых файлов
events {
use epoll;
worker_connections 10240; #максимальное число соединений с одним процессом. Система может одновременно работать с max_clients = worker_processes * worker_connections, т.е. с 81920 соединений, в том числе статических файлов
}
@Jaza
Jaza / Flask-blueprint-with-imported-routes
Last active March 10, 2024 18:26
Example of how to split a Flask blueprint into multiple files, with routes in each file, and of how to register all those routes.
*
@dfinke
dfinke / CFSBuddy.ps1
Created September 17, 2014 14:37
PowerShell v5.0 ConvertFrom-String Buddy - A GUI that helps you work with this new powerful cmdlet
#Requires -Version 5.0.9814.0
if(!($PSVersionTable.PSVersion.Major -ge 5 -and $PSVersionTable.PSVersion.Build -ge 9814)) {
"Sorry you need PSVersion 5.0.9814.0 or newer"
$psversiontable
return
}
Add-Type -AssemblyName presentationframework
@orendon
orendon / xclip_ssh_rsa.sh
Last active September 29, 2023 22:52
linux copy ssh rsa key, xclip xsel pbcopy (clipboard)
xclip -sel clip < ~/.ssh/id_rsa.pub
# in case you get a display null error
DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub
# osx
pbcopy < ~/.ssh/id_rsa.pub
## Alternative
@denji
denji / nginx-tuning.md
Last active April 17, 2025 07:26
NGINX tuning for best performance

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.

@lizhiwei
lizhiwei / send_file_partial.py
Created December 10, 2013 04:20
HTTP 206 (Partial Content) For Flask
import mimetypes
import os
import re
from flask import request, send_file, Response
@app.after_request
def after_request(response):
response.headers.add('Accept-Ranges', 'bytes')
return response
@mirontoli
mirontoli / AddLinksToCA.ps1
Created August 14, 2013 20:55
Add links into a Top Navigation Bar in SharePoint Central Admin
#Add links into a Top Navigation Bar in SharePoint Central Admin
if(-not(gsnp | ? { $_.Name -eq "Microsoft.SharePoint.PowerShell"})) { asnp Microsoft.SharePoint.PowerShell }
$url = "http://dev:2013"
$web = Get-SPWeb $url
$links = @{
"Farm Solutions" = "/_admin/Solutions.aspx"
"Service Applications" = "/_admin/ServiceApplications.aspx"
"Site Collection Owners" = "/_admin/owners.aspx"
"UPA" = "/_layouts/15/ManageUserProfileServiceApplication.aspx?ApplicationID=c32b96b6%2D7c34%2D4113%2D9982%2Df4e47aad1e50"
"SSA" = "/searchadministration.aspx?appid=5f037fe9-0cde-4bbb-a3a0-30f2605a0220"