Skip to content

Instantly share code, notes, and snippets.

View baffioso's full-sized avatar
💭
Random stuff

Anders Barfod baffioso

💭
Random stuff
  • Københavns Kommune
  • København
View GitHub Profile
@viewpointsa
viewpointsa / bd_copy_table.py
Created February 27, 2019 10:37
Copy table from postgresql database to another
import psycopg2
import argparse
def copy_table( connectionStringSrc, connectionStringDst, table_name, verbose=False, condition="" ):
with psycopg2.connect(connectionStringSrc) as connSrc:
with psycopg2.connect(connectionStringDst) as connDst:
query = "SELECT * FROM {} {};".format(table_name,condition)
with connSrc.cursor() as curSrc:
curSrc.execute( query )
print "Source number of rows =", curSrc.rowcount
@rastermanden
rastermanden / tinglysning.sql
Created September 4, 2017 11:38
tinglysning_func.sql
DROP function IF EXISTS get_tinglysning_uuid(vejnavn text, husnummer text, etage text, doer text, supplerendebynavn text, postnummer text);
CREATE OR REPLACE FUNCTION get_tinglysning_uuid(vejnavn text, husnummer text, etage text, doer text, supplerendebynavn text, postnummer text)
RETURNS json AS
$BODY$
from urllib2 import urlopen
#from simplejson import loads
import urllib
## need to set inputarguments as global variables
@rastermanden
rastermanden / stat2pg
Created April 16, 2015 11:16
statistikbanken til postgresql
DROP TABLE IF EXISTS stat.folketal;
CREATE TABLE stat.folketal
(
komkode character varying,
tid character varying,
antal integer
);
COPY stat.folketal
FROM PROGRAM
@r0mdau
r0mdau / Kibana-readonly.md
Last active July 29, 2020 06:54
Kibana readonly over internet

Kibana Readonly

With this tip, kibana can't be modified. So you can share the uri to anyone on the internet. It's a network method to protect kibana from changes of anonymous.

Quick start

  1. You need to have a working kibana exposed over http on internet
  2. On the same elasticsearch server, install nginx : apt-get install nginx
  3. In the directory /etc/nginx/sites-available, create a new file and edit it, for example : vi /etc/nginx/sites-available/kibana-readonly
  4. Write the following configuration :
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active February 25, 2025 22:09
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@walkermatt
walkermatt / wfs2postgis.sh
Created September 26, 2012 20:09
WFS to PostGIS
# Example of downloading all data from a GeoServer WFS server
# and loading it into a PostGIS database. Use with caution
# as you could put a lot of load on someone's server if they
# host a lot of data which might make them sad.
# In response to: http://underdark.wordpress.com/2012/09/26/wfs-to-postgis-in-3-steps/
BASEURL="http://data.wien.gv.at/daten/geoserver/ows?service=WFS&version=1.1.0"
for LAYERNAME in `wget -qO- $BASEURL"&request=GetCapabilities" | xpath -q -e "//FeatureType/Name/text()"` ; do
PARTS=(${LAYERNAME//:/ })