from django.http import HttpResponse
from .utils import queryset_to_workbook
def download_workbook(request):
queryset = User.objects.all()
columns = (
'first_name',
'last_name',
'email',
This file contains 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
# Get the current project | |
project = QgsProject.instance() | |
# Get a list of all layers in the project | |
layers = project.mapLayers().values() | |
# Iterate over the layers | |
for layer in layers: | |
# Check if the layer is valid | |
if layer.isValid(): |
This file contains 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
function convertTableToCSV(table) { | |
const rows = table.querySelectorAll('tr'); | |
let csv = []; | |
for (const row of rows) { | |
const cols = row.querySelectorAll('td, th'); | |
let rowArray = []; | |
for (const col of cols) { | |
rowArray.push(col.innerText.trim()); | |
} |
This file contains 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
Chain INPUT (policy ACCEPT) | |
target prot opt source destination | |
Chain FORWARD (policy DROP) | |
target prot opt source destination | |
DOCKER-USER all -- anywhere anywhere | |
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere | |
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED | |
DOCKER all -- anywhere anywhere | |
ACCEPT all -- anywhere anywhere |
This file contains 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
#!/usr/bin/env python3 | |
import sys | |
import os | |
import datetime | |
""" | |
Script to update an environment file based on a template | |
Inspired by: https://github.com/Rillke/Docker-env-file-update/blob/master/update-env.sh | |
""" |
This file contains 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
import os | |
from django.apps import AppConfig | |
from django.conf import settings | |
class CustomMetadataConfig(AppConfig): | |
name = "custom_metadata" | |
def ready(self): | |
# inject templates |
This file contains 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
import requests | |
import json | |
from typing import Any, Dict | |
# Global constants for base URL and dataset IDs | |
BASE_URL = "http://ckan:5000" | |
SOURCE_DATASET_ID = "123" | |
TARGET_DATASET_ID = "abc" | |
API_KEY = "XYZ" |
This file contains 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
from django.contrib.auth.models import Group, Permission | |
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
from django.conf import settings | |
from django.utils import timezone | |
from geonode.people.models import Profile | |
from geonode.base.models import ResourceBase | |
from geonode.layers.models import Dataset | |
from geonode.layers.utils import set_datasets_permissions | |
from guardian.shortcuts import assign_perm |
This file contains 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
c_app images |
This file contains 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
import os | |
import glob | |
import sys | |
def find_files_in_directory(folder_path): | |
search_path = os.path.join(folder_path, '**', '*') | |
file_list = glob.iglob(search_path, recursive=True) | |
file_list = [file for file in file_list if os.path.isfile(file)] | |
return file_list |