This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## From a post on the ML, apropos this: | |
## http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast. | |
## For sysctl.conf | |
net.ipv4.tcp_slow_start_after_idle = 0 | |
echo "2048 64512" > /proc/sys/net/ipv4/ip_local_port_range | |
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle | |
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// cURL obeys the RFCs as it should. Meaning that for a HTTP/1.1 backend if the POST size is above 1024 bytes | |
// cURL sends a 'Expect: 100-continue' header. The server acknowledges and sends back the '100' status code. | |
// cuRL then sends the request body. This is proper behaviour. Nginx supports this header. | |
// This allows to work around servers that do not support that header. | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); | |
// We're emptying the 'Expect' header, saying to the server: please accept the body right now. | |
// Read here: http://pilif.github.com/2007/02/the-return-of-except-100-continue/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GeometryBasics | |
x(a::AbstractVector) = first(a) | |
y(a::AbstractVector) = last(a) | |
x(a::AbstractMatrix) = a[ :, 1 ] | |
y(a::AbstractMatrix) = a[ :, 2 ] | |
function orientation(p::AbstractVector, q::AbstractVector, r::AbstractVector)::Int | |
val = ( y(q) - y(p) ) * ( x(r) - x(q) ) - ( x(q) - x(p) ) * ( y(r) - y(q) ) | |
return (val ≈ 0) ? 0 : ( (val > 0) ? 1 : 2 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Testing if the client is a mobile or a desktop. | |
### The selection is based on the usual UA strings for desktop browsers. | |
## Testing a user agent using a method that reverts the logic of the | |
## UA detection. Inspired by notnotmobile.appspot.com. | |
map $http_user_agent $is_desktop { | |
default 0; | |
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule | |
~*spider|crawl|slurp|bot 1; # bots | |
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## tmux configuration. | |
## Inspired by: https://github.com/tony/tmux-config/blob/master/.tmux.conf | |
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf | |
set-option -g status-style bg=colour235,fg=colour136,default # bg=base02, fg=yellow | |
# Easy reload config. | |
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded." | |
# set window split |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## As explained here: http://googlewebmastercentral.blogspot.com/2011/06/supporting-relcanonical-http-headers.html | |
## This is the add_header incantation to make it work. | |
add_header Link "<$scheme://$http_host$request_uri>; rel=\"canonical\""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; The following Lisp code is from ``Calendrical | |
;; Calculations'' by Nachum Dershowitz and Edward | |
;; M. Reingold, Software---Practice & Experience, vol. 20, | |
;; no. 9 (September, 1990), pp. 899--928 and from | |
;; ``Calendrical Calculations, II: Three Historical | |
;; Calendars'' by Edward M. Reingold, Nachum Dershowitz, | |
;; and Stewart M. Clamen, Software---Practice & Experience, | |
;; vol. 23, no. 4 (April, 1993), pp. 383--404. | |
;; This code is in the public domain, but any use of it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- -*- mode: lua -*- | |
-- | |
-- Stolen from http://www.cs.tufts.edu/~nr/drop/lua/cal.lua | |
-- | |
-- The following Lua code is adapted from ``Calendrical Calculations'' by Nachum | |
-- Dershowitz and Edward M. Reingold, Software---Practice & Experience, | |
-- vol. 20, no. 9 (September, 1990), pp. 899--928 and from | |
-- ``Calendrical Calculations, II: Three Historical Calendars'' by Edward M. | |
-- Reingold, Nachum Dershowitz, and Stewart M. Clamen, Software---Practice | |
-- \& Experience, vol. 23, no. 4 (April, 1993), pp. 383--404. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; This is to enable ronn files https://github.com/rtomayko/ronn to be treated as markdown files. | |
(add-to-list 'auto-mode-alist '("\\.ronn$" . markdown-mode)) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder