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
country = 'fr' | |
device = "Nokia N95 8Gb" | |
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' | |
mmap_url = 'http://www.google.com/glm/mmap' | |
geo_url = 'http://maps.google.com/maps/geo' | |
from struct import pack, unpack | |
from httplib import HTTP | |
import urllib2 | |
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
import re | |
""" | |
Detect browser and it's version. | |
Now it works only for few moct common browsers. Full list of browsers and | |
theire user-agent you can find here: http://www.useragentstring.com/pages/useragentstring.php | |
Version: 0.1 | |
Author: Andrey Nikishaev | |
Site: http://creotiv.in.ua/ |
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 getPathTo(element) { | |
if (element.id!=='') | |
return 'id("'+element.id+'")'; | |
if (element===document.body) | |
return element.tagName; | |
var ix= 0; | |
var siblings= element.parentNode.childNodes; | |
for (var i= 0; i<siblings.length; i++) { | |
var sibling= siblings[i]; |
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 urls = $('.convo .ImgLink'); | |
urls = $.makeArray(urls); | |
setTimeout(follow,300); | |
function follow() { | |
var a = urls.pop(); | |
if(!a) return; | |
var h = a.href; | |
if(h!='http://pinterest.com/30artworks/') { | |
$.ajax({url:h+'follow/',type:'POST'}); |
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
# TO_FOLDER=/something | |
# FROM=/your-es-installation | |
DATE=`date +%Y-%m-%d_%H-%M` | |
TO=$TO_FOLDER/$DATE/ | |
echo "rsync from $FROM to $TO" | |
# the first times rsync can take a bit long - do not disable flusing | |
rsync -a $FROM $TO | |
# now disable flushing and do one manual flushing |
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 accepts(exception,**types): | |
def check_accepts(f): | |
assert len(types) == f.func_code.co_argcount, \ | |
'accept number of arguments not equal with function number of arguments in "%s"' % f.func_name | |
def new_f(*args, **kwds): | |
for i,v in enumerate(args): | |
if types.has_key(f.func_code.co_varnames[i]) and \ | |
not isinstance(v, types[f.func_code.co_varnames[i]]): | |
raise exception("arg '%s'=%r does not match %s" % \ | |
(f.func_code.co_varnames[i],v,types[f.func_code.co_varnames[i]])) |
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
""" | |
A brief summary of GFS is as follows. GFS consists of three components: a client, | |
a master, and one or more chunkservers. The client is the only user-visible, | |
that is programmer-accessible, part of the system. It functions similarly to a | |
standard POSIX file library. The master is a single server that holds all metadata | |
for the filesystem. By metadata we mean the information about each file, its | |
constituent components called chunks, and the location of these chunks on various | |
chunkservers. The chunkservers are where the actual data is stored, and the | |
vast majority of network traffic takes place between the client and the chunkservers, | |
to avoid the master as a bottleneck. We will give more detailed descriptions |
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
sudo add-apt-repository ppa:pitti/postgresql | |
sudo apt-get update | |
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 | |
sudo su -l postgres | |
psql -d template1 -p 5433 | |
CREATE EXTENSION IF NOT EXISTS hstore; | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
service postgresql stop | |
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf" |
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
<?php | |
class ImageDiff { | |
// not bigger 20 | |
private $matrix = 15; | |
public function getImageInfo($image_path){ | |
list($width, $height, $type, $attr) = getimagesize($image_path); | |
$image_type = ''; |
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
/* Time zone used from your Google Callendar */ | |
FORM_OPEN_DATE = "2014-12-20 08:00"; | |
FORM_CLOSE_DATE = "2014-12-25 23:30"; | |
RESPONSE_COUNT = "100"; | |
/* Init the from and set triggers */ | |
function Initialize() { | |
deleteTriggers_(); | |