Skip to content

Instantly share code, notes, and snippets.

View bactisme's full-sized avatar

Baptiste M. bactisme

View GitHub Profile
/**
* Unpivot a pivot table of any size.
*
* @param {A1:D30} data The pivot table.
* @param {1} fixColumns Number of columns, after which pivoted values begin. Default 1.
* @param {1} fixRows Number of rows (1 or 2), after which pivoted values begin. Default 1.
* @param {"city"} titlePivot The title of horizontal pivot values. Default "column".
* @param {"distance"[,...]} titleValue The title of pivot table values. Default "value".
* @return The unpivoted table
* @customfunction
@lfalcao
lfalcao / gist:d1e0ae9ac267605967ff
Created July 14, 2015 03:19
nginx caching thumbor webp/jpg
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
proxy_cache_key "$host$request_uri-$format";
server {
listen 999;
server_name _;
set $format jpg;
if ( $http_accept ~* 'webp' ) {
set $format webp;
@stickystyle
stickystyle / MySQL network benchmark
Created April 13, 2015 16:07
Simple script to monitor the network latencey between app servers and DB servers
#!/bin/env python
import timeit
loops = 1000
setup = """
import MySQLdb
db = MySQLdb.connect(host="remotedb.example.com",
read_default_file="/root/.my.cnf",
@fire
fire / rails-discourse.xml
Last active April 19, 2017 11:40
Smartos install of discourse
@magnetikonline
magnetikonline / README.md
Last active April 30, 2024 00:45
Setting Nginx FastCGI response buffer sizes.
<?php
// CONFIG
$servers = array(
array('Local', '127.0.0.1', 6379),
);
// END CONFIG
$server = 0;
if (isset($_GET['s']) && intval($_GET['s']) < count($servers)) {
$server = intval($_GET['s']);
@denji
denji / nginx-tuning.md
Last active May 24, 2024 05:32
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.

@mhulse
mhulse / admin.py
Created September 19, 2011 19:25
Django google maps v3 snipplet [via] admin example (tested in Django 1.4.x) (second example)
from <app_name>.models import Foo
# ...
# Using the default admin interface:
admin.site.register(Foo)