If you want to use the latest available version of Squid, you can Build a Squid anonymous proxy from source code
This file contains hidden or 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
| #!/bin/sh | |
| version="2.6.3" | |
| priority="20603" | |
| sudo mkdir -p /var/redis /var/log/redis | |
| curl -sL http://redis.googlecode.com/files/redis-${version}.tar.gz | tar zx | |
| cd redis-${version}/ | |
| make | |
| sudo make PREFIX=/usr/local/redis/${version} install |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import sys | |
| import Image | |
| def autocrop_image(image, border = 0): | |
| # Get the bounding box | |
| bbox = image.getbbox() | |
| # Crop the image to the contents of the bounding box |
This file contains hidden or 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
| var p1 = { | |
| x: 20, | |
| y: 20 | |
| }; | |
| var p2 = { | |
| x: 40, | |
| y: 40 | |
| }; |
This file contains hidden or 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
| ''' | |
| PIL's Image.thumbnail() returns an image that fits inside of a given size (preserving aspect ratios) | |
| but the size of the actual image will vary and is certainly not guaranteed to be the requested size. | |
| This is often inconvenient since the size of the returned thumbnail cannot be predicted. The django-thumbs | |
| library solves this for square thumbnails by cropping the image to a square and then resizing it. However, | |
| this only works for exact squares. | |
| This function generalizes that approach to work for thumbnails of any aspect ratio. The returned thumbnail | |
| is always exactly the requested size, and edges (left/right or top/bottom) are cropped off to adjust to | |
| make sure the thumbnail will be the right size without distorting the image. |
This file contains hidden or 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 |