- modify
/etc/postgresql/9.5/main/postgresql.conf
add listen_addresses = '*'
- modify
/etc/postgresql/9.5/main/pg_hba.conf
add host all all 0.0.0.0/0 trust
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
from pyspark.sql import SparkSession | |
spark = SparkSession \ | |
.builder \ | |
.appName("demography mapper") \ | |
.getOrCreate() | |
df_user = spark.read.format("com.mongodb.spark.sql.DefaultSource")\ | |
.option("spark.mongodb.input.uri", "mongodb://localhost:27017/raw.user").load() |
d3.layout.cloud().size([1200, 600]) | |
.words([ | |
".NET", "Silverlight", "jQuery", "CSS3", "HTML5", "JavaScript", "SQL","C#"].map(function(d) { | |
return {text: d, size: 10 + Math.random() * 50}; | |
})) | |
.rotate(0) | |
.fontSize(function(d) { return d.size; }) | |
.padding(5) | |
.spiral("archimedean") | |
.rotate(function() { return ~~(Math.random() * 2) * 90; }) |
select * | |
from pg_stat_activity | |
where datname = 'db_name' |
from functools import wraps | |
from flask import Flask, request | |
app = Flask(__name__) | |
key = "ya29.bwLu0ruxXdXe_RMOSYgfiCPORNMHLkf9rCDmV1rKtWu90TuF1d8B2SmdUlrjeOWNYThkgMM" | |
def secure(f): | |
@wraps(f) | |
def check_authorization(*args, **kwargs): | |
if request.headers.get("Authorization") == key: | |
return f() |