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
// Taken from http://svn.apache.org/repos/asf/nutch/trunk/src/java/org/apache/nutch/util/EncodingDetector.java | |
/** | |
* Parse the character encoding from the specified content type header. | |
* If the content type is null, or there is no explicit character encoding, | |
* <code>null</code> is returned. | |
* <br /> | |
* This method was copied from org.apache.catalina.util.RequestUtil, | |
* which is licensed under the Apache License, Version 2.0 (the "License"). | |
* | |
* @param contentType a content type header |
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
public String byteToHex(final byte b) { | |
// Returns hex String representation of byte b | |
char hexDigit[] = { | |
'0', '1', '2', '3', '4', '5', '6', '7', | |
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' | |
}; | |
char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] }; | |
return new String(array); | |
} |
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
wget --wait=20 --limit-rate=20K -r -p -U Mozilla http://guides.rubyonrails.org/getting_started.html |
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
sudo /etc/init.d/mysql stop | |
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking & | |
mysql -u root | |
FLUSH PRIVILEGES; | |
SET PASSWORD FOR root@'localhost' = PASSWORD('password'); | |
#If you have a mysql root account that can connect from everywhere, you should also do: | |
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root'; | |
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
wget http://sphinxsearch.com/files/sphinxsearch_2.0.5-release-0ubuntu11~precise2_amd64.deb | |
apt-get install libpq5 | |
# install deb package | |
dpkg -i sphinxsearch_2.0.5-release-0ubuntu11~precise2_amd64.deb | |
# this will install following commands | |
# /usr/bin/searchd | |
# /usr/bin/indexer | |
# /usr/bin/search |
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
server { | |
listen 80 default ; ## listen for ipv4; this line is default and implied | |
#listen [::]:80 default ipv6only=on; ## listen for ipv6 | |
charset utf-8; | |
#root /usr/share/nginx/www; | |
#root /var/www/evevgez.com/html; | |
root /vagrant/html/evevgez-search ; | |
# Make site accessible from http://localhost/ | |
server_name _; | |
client_max_body_size 20M; |
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
/* | |
Map.getBounds() gives you the lat/lng bounds of the current viewport. You can then use | |
LatLngBounds.getNorthEast() and LatLngBounds.getSouthWest() to get north-east (top right) | |
and south-west (bottom-left) coordinates as LatLng. More specifically: | |
ref: http://stackoverflow.com/questions/14285963/google-maps-get-viewport-latitude-and-longitude | |
*/ |
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
vagrant box add base-jruby http://files.vagrantup.com/lucid64.box | |
cd <project directory> | |
vagrant init base-jruby | |
vagrant plugin install vagrant-vbguest | |
vagrant up | |
vagrant ssh | |
sudo apt-get update |
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
wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb | |
sudo dpkg -i puppetlabs-release-precise.deb | |
sudo apt-get update | |
sudo apt-get -y install puppet |
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
\curl -sSL https://get.rvm.io | bash | |
source /home/vagrant/.rvm/scripts/rvm | |
rvm install jruby | |
gim install rails |
OlderNewer