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
21 May 03:38:59 - info: Loading genesis block | |
21 May 03:38:59 - info: Connecting to peer localhost:8333 | |
21 May 03:38:59 - info: Connection refused for localhost:8333 | |
21 May 03:38:59 - info: IRC Bootstrap found 14 peers | |
21 May 03:39:04 - info: Connecting to peer 142.244.185.198:18333 | |
21 May 03:39:04 - info: Connecting to peer 67.82.96.109:18333 | |
21 May 03:39:04 - info: Connecting to peer 81.141.76.31:18333 | |
21 May 03:39:04 - info: Connecting to peer 178.18.90.41:18333 | |
21 May 03:39:04 - info: Connecting to peer 66.9.24.5:18333 | |
21 May 03:39:04 - info: Connecting to peer 109.239.89.147:18333 |
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 url = require("url"); | |
function parseConnectionString(str) { | |
var result = url.parse(str); | |
result.host = result.hostname; | |
result.database = result.pathname ? result.pathname.slice(1) : null; | |
var auth = (result.auth || ':').split(':'); | |
result.user = auth[0]; | |
result.password = auth[1]; | |
return result; |
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
SELECT avg(tagspernode) FROM (SELECT id, count(tags) AS tagsPerNode FROM (SELECT each(tags) as tags, id FROM nodes) AS tuples GROU LIMIT 10000) BY id) AS foo; |
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
SELECT id, tags->'amenity' AS value, tags FROM nodes WHERE tags ? 'amenity' ORDER BY tags->'amenity'; |
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
--does not work... | |
CREATE OR REPLACE FUNCTION myinsert(tablename text, g geometry, s hstore) RETURNS integer AS $$ | |
DECLARE i integer; | |
DECLARE sequencename text; | |
DECLARE sql text; | |
BEGIN | |
sequencename = tablename || '_sequence_id'; | |
i = nextval(sequencename); | |
sql = 'INSERT INTO ' || tablename || '(id, geom, store) VALUES ('|| i ||', '|| g ||','|| s ||');'; | |
EXECUTE sql; |
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
pg = require "pg" | |
pg.connect "pg://postgres:secret@localhost:5432/testing", (error, client) -> | |
if error | |
console.log error | |
else | |
query = "SELECT NOW() AS when;" | |
client.query query, (error, result) -> | |
if error then console.log error | |
else console.log result |
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
CREATE FUNCTION public.hs_2json(hs hstore) RETURNS text AS $$ | |
DECLARE | |
rv text; | |
r record; | |
BEGIN | |
rv:=''; | |
for r in (select key, val from each(hs) as h(key, val)) loop | |
if rv<>'' then | |
rv:=rv||','; | |
end if; |
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
pg = require "pg" | |
http = require "http" | |
redis = require "redis" | |
rclient = redis.createClient() | |
rclient.on "error", (error) -> | |
console.log error | |
(http.createServer (req, res) -> |
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
pg = require "pg" | |
http = require "http" | |
s = "postgres://postgres:testing@localhost:5432/testing" | |
(http.createServer (req, res) -> | |
pg.connect s, (error, client) -> | |
if error | |
console.log error | |
else |
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
git = require "nodegit" | |
git.repo "bla/.git", (error, repo) -> | |
if error then console.log error | |
else | |
repo.branch "master", (error, branch) -> | |
if error then console.log error | |
else | |
history = branch.history() | |
history.on "commit", (index, commit) -> |
OlderNewer