Skip to content

Instantly share code, notes, and snippets.

@denji
denji / nginx-tuning.md
Last active July 13, 2026 11:06
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.

#1: Control ls command output
## Colorize the ls output ##
alias ls='ls --color=auto'
## Use a long listing format ##
alias ll='ls -la'
## Show hidden files ##
alias l.='ls -d .* --color=auto'
@lockjs
lockjs / VBoxInstall.sh
Created January 12, 2014 10:02
Simple shell script to install VirtualBox and Extensions for Linux Mint (Ubuntu / Debian[?])
#!/bin/bash
# Install VirtualBox
echo "Do you want to install VirtualBox? [Y/n]"
read INPUT
if [[ "$INPUT" == 'Y' || "$INPUT" == 'y' ]]; then
# Select major version
DEFAULT=4.2
echo "Select version e.g. $DEFAULT"
read VER
@mitio
mitio / apache-stats
Last active June 1, 2021 09:27
A few tiny shell scripts for quick diagnostics of possible web server problems
#!/bin/sh
grep -E '^Listen ' /etc/apache2/ports.conf | sed 's/:/./' | sed 's/Listen //' | \
ruby -e 'conns = []; while conn = gets; conns << conn.strip; end; system "netstat -an|grep tcp|grep -v LISTEN|grep -E \"\\b#{conns.join "\\b|\\b"}\\b\"";' | awk '{ print $5 }' | ruby -e 'conns = Hash.new(0); while conn = gets; parts = conn.strip.split(":"); ip = parts[0]; port = parts[-1]; conns[ip] += 1; end; conns.sort_by { |ip, count| -count }.each { |ip, count| puts "IP: #{ip.ljust(25)} connections: #{count.to_s.ljust(8)}" } ;nil'
@UniIsland
UniIsland / list-manually-installed-packages.sh
Created February 8, 2014 08:20
List all manually installed packages on a debian/ubuntu system
#!/bin/bash
## List all manually installed packages on a debian/ubuntu system
## manually installed means:
## 1. not pre-installed with the system
## 2. not marked auto-installed by apt (not dependencies of other
## packages)
## Note: pre-installed packages that got updated still needs to be
## filtered out.
@woods
woods / gen-key-script
Last active October 31, 2024 23:23
Creating gpg keys non-interactively
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Name-Email: root@handbook.westarete.com
Expire-Date: 0
@thatmaheshrs
thatmaheshrs / listInstalledPackages.sh
Created March 8, 2014 08:17
This shell script lists ALL the packages installed on any Linux system that uses dpkg for package management such as Debian, Ubuntu, Kubuntu, Xubuntu, Lubuntu, Linux Mint, Kali Linux, Bodhi Linux, etc.
#!/bin/bash
# COPYRIGHT: That Mahesh RS (https://sites.google.com/site/thatmaheshrs)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@9to5IT
9to5IT / Logging_Functions.ps1
Last active April 15, 2025 13:52
PowerShell: Logging Functions
Function Log-Start{
<#
.SYNOPSIS
Creates log file
.DESCRIPTION
Creates log file with path and name that is passed. Checks if log file exists, and if it does deletes it and creates a new one.
Once created, writes initial logging data
.PARAMETER LogPath
@jonforums
jonforums / ubuntu-nginx-cgit
Last active September 28, 2024 03:19
ubuntu server, nginx, and cgit via fcgiwrap+spawn-fcgi
# install nginx via your favorite method
...
# ensure primary nginx config file `/etc/nginx/nginx.conf` contains the following within
# the `http` block so that symlinked config from /etc/nginx/sites-available/* are included
include /etc/nginx/sites-enabled/*;
# install deps and build fcgiwrap
sudo aptitude install spawn-fcgi libfcgi-dev
curl -L -o fcgiwrap-1.1.0.tar.gz http://github.com/gnosek/fcgiwrap/archive/1.1.0.tar.gz
@laurenorsini
laurenorsini / MakeOpenVPN.sh
Last active June 25, 2025 05:19
MakeOpenVPN.sh by Eric Jodoin
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"