Skip to content

Instantly share code, notes, and snippets.

@denji
denji / nginx-tuning.md
Last active April 24, 2024 19:39
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.

@craigmdennis
craigmdennis / horizontal.masonry.js
Created July 5, 2011 10:48
Simple Horizontal Masonry
/**
* Builds a horizontal masonry in whats possbily (i haven't researched
* the techniques) a crude manner.
* Fits elements into columns if there is room and sets the width of
* the container element to contain all the columns.
*
* Known Issues:
* - Does not do anything clever for elements where height exceeds
* window height (probably just gets chopped off if overflow: hidden)
* - All elements are expected to be the column width
@ChewingPencils
ChewingPencils / gist:2777049
Created May 23, 2012 18:52
External Drafts Bookmarklet js file.
/*
Drafts App Bookmarklets (http://agiletortoise.com/drafts)
Author: Sean Korzdorfer
Date: 13:51:29 Wed May 23 2012
Re: https://gist.github.com/gists/2579288
Most of the Date functions used snippets I created from:
http://www.webdevelopersnotes.com/tips/html/10_ways_to_format_time_and_date_using_javascript.php3
*/
<?php
// get the post UID from the URL
$uid = param('post');
if(!$uid) die(a::json(array(
'status' => 'error',
'msg' => 'The post could not be found',
)));
@simonscheiber
simonscheiber / sitemap.php
Created August 15, 2012 22:07
Kirby sitemap generator excluding invisible folders
<?php
$ignore = array('sitemap', 'error');
// send the right header
header('Content-type: text/xml; charset="utf-8"');
// echo the doctype
echo '<?xml version="1.0" encoding="utf-8"?>';
<form action="<?php echo url('search') ?>" method="get">
<!-- html for your global search form -->
</form>
@omz
omz / Top Apps.py
Created November 7, 2012 20:54
Top Apps
# Shows a list of the 10 top paid apps on the App Store.
print 'Loading...'
import feedparser
import console
print 'Fetching Feed...'
feed = feedparser.parse('http://itunes.apple.com/us/rss/toppaidapplications/limit=10/xml')
entries = feed['entries']
@wrenoud
wrenoud / DropboxSync.py
Created November 10, 2012 02:46
DropboxSync
import os
import sys
import pickle
import console
# I moved 'dropboxlogin' into a sub folder so it doesn't clutter my main folder
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
import dropboxlogin # this code can be found here https://gist.github.com/4034526
STATE_FILE = '.dropbox_state'
@ChewingPencils
ChewingPencils / taskpaper_drafts_action.txt
Created February 7, 2013 14:46
Drafts action to append an indented task with an indented note
drafts://x-callback-url/import_action?type=dropbox&name=TaskPaper%20with%20Indented%20Note&path=%2FTaskPaper%2F&filenametype=2&filename=filename&ext=txt&writetype=0&template=%09-%20%5B%5Btitle%5D%5D%0A%09%09%5B%5Bbody%5D%5D
@tofias
tofias / Search Pinboard from Drafts
Created February 7, 2013 21:57
Search Pinboard from Drafts
drafts://x-callback-url/import_action?type=URL&name=Search%20in%20Pinboard&url=https%3A%2F%2Fm.pinboard.in%2Fsearch%2F%3Fquery%3D%5B%5Bdraft%5D%5D%26mine%3DSearch%2BMine