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
#!/bin/bash | |
# CACHE WARMER script for XML Sitemaps with MULTIPLE SUB-SITEMAPS: | |
DOMAIN='https://www.xyz.com' | |
wget -q $DOMAIN/sitemap.xml --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read subsite; | |
do | |
echo --- Reading sub-sitemap: $subsite: --- | |
wget -q $subsite --no-cache -O - | egrep -o "$DOMAIN[^<]+" | while read line; | |
do | |
echo $line: | |
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1 |
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
# Default backend definition. Set this to point to your content server. | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
.connect_timeout = 60s; | |
.first_byte_timeout = 60s; | |
.between_bytes_timeout = 60s; | |
.max_connections = 800; | |
} |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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 fabric script automates the creation of a virtual environment and a Django | |
project. The result will be virtual environtment with the name of the project. | |
The folder namer where the project code will be placed is specified in | |
SOURCE_DIRECTORY_NAME, a static root folder will be created and settings.py | |
will be updated. | |
""" | |
try: | |
from fabric.api import env, run, local | |
from fabric.context_managers import lcd, prefix |
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 two lines give a two-line status, with the current window highlighted | |
hardstatus alwayslastline | |
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]' | |
# huge scrollback buffer | |
defscrollback 5000 | |
# no welcome message | |
startup_message off |
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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
document.write('<style type="text/css">body{padding); margin:0}</style>'); | |
document.write('<iframe id="iwonder_hack" src="http://' + location.host + '/" width="100%" height="100%" style="border:0;padding:0;margin:0"></iframe>'); | |
setTimeout(function(){ | |
var frmdoc = document.getElementsByTagName('iframe')[0].contentWindow.document | |
,rotation = 0 | |
,links = frmdoc.getElementsByTagName('a') | |
,images = frmdoc.getElementsByTagName('img') | |
,props = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform'] | |
,transform = function(elem, trans) { | |
for (var i = 0; i < props.length; i++) { |
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
# install git | |
sudo apt-get install -y g++ curl libssl-dev apache2-utils | |
sudo apt-get install -y git-core | |
mkdir ~/src | |
cd ~/src | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node |
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
# install git | |
sudo apt-get install -y g++ curl libssl-dev apache2-utils | |
sudo apt-get install -y git-core | |
mkdir ~/src | |
cd ~/src | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node |