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
# | |
# redis-geo-test.py | |
# Redis proof-of-concept for geo searching | |
# | |
# Created by Berry Groenendijk on 2010-04-30. | |
# Copyright 2010 - personal project. All rights reserved. | |
# | |
import redis | |
from random import Random |
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
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'rubygems' | |
require 'nokogiri' | |
uri = "http://whatthecommit.com" | |
doc = Nokogiri::HTML.parse(open(uri).read) | |
puts doc.at("//div[@id='content']/p").inner_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
from __future__ import with_statement | |
from fabric.api import env, run, settings, hide | |
from fabric.decorators import hosts, runs_once | |
venv = "/home/websites/.virtualenvs/twtv3/" | |
env.user = 'webdev' | |
env.hosts = [ | |
'192.168.1.10', | |
'192.168.1.11', |
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
-- Function: v_get_tile(integer, integer, integer) | |
-- DROP FUNCTION v_get_tile(integer, integer, integer); | |
CREATE OR REPLACE FUNCTION v_get_tile(x integer, y integer, z integer) | |
RETURNS geometry AS | |
$BODY$ | |
DECLARE | |
origin_shift CONSTANT FLOAT := 20037508.342789244; | |
initial_resolution CONSTANT FLOAT := 156543.03392804062; |
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
""" | |
Run a websocket and HTTP server on port 7000. The web page served over HTTP | |
connects to the websocket server and waits for database notifications. | |
After loading the page, connect to your database and run | |
=# NOTIFY data, 'some text'; | |
which should make 'some text' appear in the textarea. |
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
function key(type, code) { | |
var e = document.createEvent("Event"); | |
e.initEvent(type, true, true); | |
e.keyCode = code; | |
document.getElementById("hplogo").dispatchEvent(e); | |
} | |
setInterval(function() { | |
key("keydown", 37); | |
key("keypress", 37); |
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
-- Create a function withn the security set to Definer so that it can insert | |
CREATE OR REPLACE FUNCTION cdb_insert_point(float, float) RETURNS integer | |
AS 'INSERT INTO example_table(the_geom) VALUES(ST_SetSRID(ST_MakePoint($1,$2),4326)) RETURNING cartodb_id;' | |
LANGUAGE SQL | |
SECURITY DEFINER | |
RETURNS NULL ON NULL INPUT; | |
--Grant access to the public user | |
GRANT EXECUTE ON FUNCTION cdb_insert_point(float,float) TO publicuser; |
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
license: gpl-3.0 |
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
# before this file is loaded, a locale should be set: | |
# | |
# In a browser environment, you can use: | |
# ```<script>__locale='en';</script>``` | |
# | |
# In a server environment (specifically node.js): | |
# ```global.__locale = 'en';``` | |
# normalize in-app locale string to "en" or "de-AT" | |
parts = @__locale.split('-') |
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
create table rank (id UInt64, rank_column LowCardinality(String), c0 AggregateFunction(sum, Int32)) | |
engine = AggregatingMergeTree order by id; | |
create table nop (id UInt64, rank_column LowCardinality(String), c Int32) Engine= Null; | |
create materialized view nop_mv to rank as select id, rank_column, sumState(c) as c0 from nop group by id, rank_column | |
insert into nop select number id, toString(id % 150000), toInt32(rand() % 4234234) from numbers(100000000) | |
optimize table rank final; |
OlderNewer