Skip to content

Instantly share code, notes, and snippets.

@eMerzh
eMerzh / pdo_test.php
Created July 4, 2012 08:51
Pg PDO test
<?php
/** createuser -d -R -S -P test
* => set password to "a b c"
*/
$dsn = "pgsql:dbname=test;host=localhost";
$user = "test";
$psw = "a b c";
try{
@eMerzh
eMerzh / mdb2_schema.patch
Created October 25, 2012 22:34
Patch For MDB2 schema migration with PG
diff --git a/3rdparty/MDB2/Driver/Manager/pgsql.php b/3rdparty/MDB2/Driver/Manager/pgsql.php
index f2c2137..3e70f3a 100644
--- a/3rdparty/MDB2/Driver/Manager/pgsql.php
+++ b/3rdparty/MDB2/Driver/Manager/pgsql.php
@@ -363,6 +363,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
return MDB2_OK;
}
+ $unquoted_name = $name;
$name = $db->quoteIdentifier($name, true);
define postgresql::db ($name, $ensure=present){
case $ensure {
present: {
exec { "Create $name postgres db":
command => "createdb $name",
unless => "test \$(psql -tA -c \"SELECT count(*)=1 FROM pg_catalog.pg_database where datname='${name}';\") = t",
}
}
absent: {
exec { "Remove $name postgres db":
@eMerzh
eMerzh / style.css
Created March 16, 2013 11:12
tt-rss custom style adaptations to have more contrasts
.Selected .cdmHeader {
background-color: #91C3EE;
font-weight: bold;
}
div.cdmFeedTitle > div:first-child {
float: left !important;
margin-right: 5px;
}
@eMerzh
eMerzh / default_logstash.sh
Last active December 16, 2015 13:39
/etc/init.d/logstash
START=yes
LS_JAR=/opt/logstash/logstash-1.1.12-flatjar.jar
#Options not supported in some debian
LS_JAVA_OPTS=
@eMerzh
eMerzh / shp2pgsql-core.c
Created May 20, 2013 17:01
Postgis Numeric : postgis-2.0.3/loader/shp2pgsql-core.c
1470,1477c1470
< void removeChar(char *str, char garbage) {
< char *src, *dst;
< for (src = dst = str; *src != '\0'; src++) {
< *dst = *src;
< if (*dst != garbage) dst++;
< }
< *dst = '\0';
< }
---
@eMerzh
eMerzh / fix.py
Last active December 18, 2015 09:19
#!/bin/jython
'''
This code is released under the WTFPL
It tries to fix Urbis osm files (missing addresses in relation )
'''
from javax.swing import JOptionPane
from org.openstreetmap.josm import Main
import org.openstreetmap.josm.command as Command
@eMerzh
eMerzh / urbis.sh
Created July 3, 2013 14:02
urbis stats
wget http://download.geofabrik.de/europe/belgium-latest.osm.pbf
osm2pgsql/osm2pgsql -S /home/chaos/os/default.style -s -v -x -j -U osm -d gis -H 127.0.0.1 -W belgium-latest.osm.pbf --bbox 3.981,50.645,4.761,51.053
#then sql =)
@eMerzh
eMerzh / GCAllocine.pm
Created December 28, 2013 23:18
Patch for gcstar
package GCPlugins::GCfilms::GCAllocine;
###################################################
#
# Copyright 2005-2010 Christian Jodar
#
# This file is part of GCstar.
#
# GCstar is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@eMerzh
eMerzh / test.py
Last active October 7, 2015 14:51
# -*- coding: utf-8 -*-
from celery import Celery, group, chain, chord
app = Celery('tasks', broker='redis://localhost:6379/0', backend='redis://localhost:6379/0?new_join=1')
app.conf.CELERY_CHORD_PROPAGATE = True
@app.task
def add(x):
if(x == 3):
raise Exception('arg')