Skip to content

Instantly share code, notes, and snippets.

View t-book's full-sized avatar
💭
reading

Toni t-book

💭
reading
View GitHub Profile
@t-book
t-book / fix_urls.sh
Last active December 2, 2019 15:02
#!/bin/bash
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET thumbnail_url = replace(thumbnail_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET ows_url = replace(ows_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET layer_params = replace(layer_params, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET source_params = replace(source_params, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_mapsnapshot SET config = replace(config, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET supplemental_information = replace(supplemental_information, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET csw_anytext = replace(csw_anytext, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE django_site SET domain = replace(domain, '$1', '$2')"
@t-book
t-book / v.js
Created December 2, 2018 09:55
let v = {
isNum: n => !isNaN(parseFloat(n)) && isFinite(n),
PartiThes: n => {
let validates = true;
let str = n.split(", ");
str.forEach(s => {
let substr = s.split(" ");
validates = v.isNum(substr[0]) ? validates : false;
validates = material.includes(substr[1]) ? validates : false;
});
@t-book
t-book / check_thumbs.js
Last active January 17, 2019 15:30
Check thumbs js fetch
function handleErrors(response) {
if (!response.ok) {
throw Error(response.statusText);
}
return response;
}
let thumbs = [];
fetch("http://master.demo.geonode.org/api/layers/")
.then(r => r.json()).then(data => {
sudo service apache2 stop; sudo service tomcat8 stop
rm -rf geonode-project/
virtualenv ~/.venv/master; source ~/.venv/master/bin/activate
git clone https://github.com/GeoNode/geonode-project.git -b master
pip install Django==1.11.16
mv my_geonode/ my_geonode_old
@t-book
t-book / Apache:GeoNode SSL-TLS LE Authority
Last active May 7, 2019 19:21
Add let´s enrypt to geonode
# - Close port 8080 for inbound networking
# - Edit your local_settings to use proxy /geonode (and not port 8080)
# - Add following to local_settings: AVATAR_GRAVATAR_SSL = True
# - make sure mod_ssl is active: $ a2enmod ssl
# add let´s encrypt repository
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
# install certbot
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.33.12"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4024"
end
@t-book
t-book / README.txt
Last active April 3, 2019 06:59
a systemd service file for geonode
# --- Usage ---
sudo vim /etc/systemd/system/geonode-celery.service
sudo systemctl enable geonode-celery # Enables the service (on boot)
sudo systemctl restart geonode-celery
sudo systemctl start geonode-celery
sudo systemctl stop geonode-celery
sudo systemctl status geonode-celery
sudo systemctl daemon-reload
sudo systemd-analyze verify geonode-celery
This file has been truncated, but you can view the full file.
{
"total": 632,
"result": [
{"@id":"https://gazetteer.dainst.org/place/2757738","gazId":"2757738","parent":"https://gazetteer.dainst.org/place/2066109","ancestors":["https://gazetteer.dainst.org/place/2044223","https://gazetteer.dainst.org/place/2042600"],"types":["administrative-unit"],"prefName":{"title":"Vlorë","language":"sqi"},"prefLocation":{"coordinates":[19.8,40.16667],"confidence":0,"publicSite":true},"identifiers":[{"value":"3344952","context":"geonames"}],"links":[{"object":"http://sws.geonames.org/3344952","predicate":"owl:sameAs"}],"provenance":["Albanian Archaeological Sites","geonames"],"parents":[{"@id":"https://gazetteer.dainst.org/place/2066109","gazId":"2066109","parent":"https://gazetteer.dainst.org/place/2044223","relatedPlaces":["https://gazetteer.dainst.org/place/2359911","https://gazetteer.dainst.org/place/2359913","https://gazetteer.dainst.org/place/2066207","https://gazetteer.dainst.org/place/2758045"],"ancestors":["https://gazetteer.dainst.org/place/2042600"],"types":["administrativ
{
"labels": [
"Mice",
"Birds",
"Apes"
],
"data": [
10,
20,
290
@t-book
t-book / 0.json
Last active August 19, 2019 14:31
{
"visitors": {
"data": {
"labels": [
"Dogs",
"Cats",
"Elephant"
],
"datasets": [
{