Skip to content

Instantly share code, notes, and snippets.

View jadia's full-sized avatar
💭
Progress beats Perfect.

Nitish Jadia jadia

💭
Progress beats Perfect.
View GitHub Profile
@denji
denji / nginx-tuning.md
Last active May 21, 2024 18:18
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.

@junfenglx
junfenglx / semaphores.c
Created November 11, 2013 13:12
named semaphores use example.
#include <stdio.h> /* printf() */
#include <stdlib.h> /* exit(), malloc(), free() */
#include <unistd.h>
#include <sys/types.h> /* key_t, sem_t, pid_t */
#include <sys/wait.h>
#include <sys/shm.h> /* shmat(), IPC_RMID */
#include <errno.h> /* errno, ECHILD */
#include <semaphore.h> /* sem_open(), sem_destroy(), sem_wait().. */
#include <fcntl.h> /* O_CREAT, O_EXEC */
@timothyandrew
timothyandrew / README.md
Last active December 16, 2023 17:05
Set up a seedbox (on DigitalOcean – Ubuntu) really quick

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.
@mocchira
mocchira / curl_range.md
Last active March 4, 2024 04:17
HTTP GET with Range header by curl
  • normal(explicitly specified start AND end)
  curl -v -X GET -H "range: bytes=1-8" http://localhost:8080/bbb/test
  • specified ONLY start(end will be specified at the end of file)
  curl -v -X GET -H "range: bytes=10-" http://localhost:8080/bbb/test
  • specified ONLY one negative value(last N bytes of file will be retrieved)
@IngmarBoddington
IngmarBoddington / shellScripting
Last active February 14, 2022 17:23
Notes on shell scripting in Linux. Should be used in conjunction with terminal notes: https://gist.github.com/IngmarBoddington/4226355
Basics
======
Expansion (special symbols replaced by values) and word splitting (arguments being split into several aruments) must have attemtion paid or pain will follow.
- # for comments
- Lots of internal variables available to bash scripts, see: http://tldp.org/LDP/abs/html/internalvariables.html#ARGLIST
- Name of script will be $0
- Parameters passed to script will be in $1, $2, $3.... vars and count in $#
@IngmarBoddington
IngmarBoddington / terminal
Last active August 23, 2020 16:04
General Linux / Bash Terminal Reference, commonly used commands and file locations. Key: <value> type of value will be hinted by string when relevant | [<optionalValue>] | <file(s)> means single filename or multiple space delimited filenames | <int>
Command History
===============
!! - Repeat previous command
!!:/s/<search>/<replace>/g - Repeat previous command with replaced string value
sudo !! - Repeat previous command with sudo
history - Show bash history
!<int> - Run a labelled command from history command
!<command> a - Re-run last use of command
<command>:p - Print rather than run (e.g. !!:p, to print last run command)
^<search>^<replace> - Run previous command replacing search with replace (for typos)
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>