$ brew install colordiff
$ brew install gnu-sed
$ wget http://www.pixelbeat.org/scripts/ansi2html.sh -O /tmp/ansi2html.sh && chmod +x /tmp/ansi2html.sh
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 | |
| # set unique $FILENAME | |
| FILENAME=$(date +%d-%m-%y)-${APP_NAME}-${APP_ENV} | |
| # set $LOG_URI (tail/download) | |
| LOG_URI=https://bbc/logs/error_log/download/${APP_ENV}/error_log | |
| # limit the $NUMBER_OF_LINES when processing large files (default: 4000 lines) | |
| NUMBER_OF_LINES=${NUMBER_OF_LINES:=4000} |
DOMAIN="m.bbc.co.uk"
SERVICE="hindi"
HTTP_USER_AGENT="Mozilla/5.0 (iPhone; Mobile; AppleWebKit; Safari)"
EXCLUDE_EXTENSIONS="\.\(txt\|css\|js\|png\|gif\|jpg\)$"
MAX_DEPTH="3"
wget --spider --no-directories --no-parent --force-html --recursive \
--level=$MAX_DEPTH --no-clobber \
- Create list of sites to visit: arabic, hindi, russian, mundo, etc.
- Define supported screen widths, for example: 176, 208, 240, 320, 352.
- Define the maximum size of an image. The current average size of a mobile page is 250 KB.
- Quality: 100% - File size: 822 KB: http://goo.gl/A4ldIF
- Quality: 50% - File size: 272 KB:http://goo.gl/AAbrY9
- Quality: 30% - File size: 193 KB: http://goo.gl/gOUkXK
- Crawl sites in a distributed, scalable and efficient way (scheduling policy, async requests, politeness, message queues, path-ascending crawling).
- Note: The app must run very well on Linux and should also be capable of test runs on OSX.
Get the absolute position of every link in an html document using JavaScript:
/**
* The HTML <area> coords attribute needs the position of the left, top, right, bottom corner
* of the rectangle. Element.getBoundingClientRect returns a text rectangle object that encloses
* a group of text rectangles.
*/
function getElementAbsolutePosition(element) {
var pos = {};
pos.left = 0;
ssh -i ~/.ec2/my.pem [email protected] "cat /var/log/secure | grep 'refused connect'"
When using SSH to run commands across multiple machines without exchanging your public key, you need to type in your password for each machine. A quick and simple way of setting this up is to create a public key:
ssh-keygen -t rsa
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
| def rgb_from_str(s): | |
| # s starts with a #. | |
| r, g, b = int(s[1:3],16), int(s[3:5], 16),int(s[5:7], 16) | |
| return r, g, b | |
| def find_nearest_colour(R,G, B, colorD): | |
| mindiff = None | |
| for d in colorD: | |
| r, g, b = rgb_from_str(colorD[d]) |
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
| function rgbToHex(r, g, b) { | |
| return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); | |
| } |