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
DO $$ | |
DECLARE | |
source_app text := 'old_app_name'; | |
target_app text := 'new_app_name'; | |
BEGIN | |
EXECUTE format('UPDATE django_migrations SET app = %L WHERE app = %L', target_app, source_app); | |
EXECUTE ( | |
SELECT string_agg( | |
'ALTER TABLE ' || tablename || ' RENAME TO ' || replace(tablename, source_app, target_app), |
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
# To path: plane/db/management/commands | |
# Example: python manage.py import_trello_data path/to/data.json 111ae9b3-cefc-4c25-adf2-48c0932d40e0 | |
import random | |
import json | |
import requests | |
from django.core.management.base import BaseCommand | |
from django.core.files.base import ContentFile | |
from django.db import transaction | |
from plane.db.models import ( |
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 json | |
import subprocess | |
import sys | |
def parse_gitleaks_report(report_path, secrets_path): | |
with open(report_path, 'r') as file: | |
data = json.load(file) | |
with open(secrets_path, 'w') as file: | |
for item in data: |
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 functools import partial | |
import os | |
import time | |
import multiprocessing | |
def _func_with_args(func, args): | |
return func(*args) | |
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 datetime | |
from inspect import signature | |
from flask import request, jsonify, make_response, Blueprint, current_app | |
from flask.views import MethodView | |
from flask_jwt_extended import current_user, jwt_required | |
from marshmallow import Schema, fields | |
from sqlalchemy import inspect as sqla_inspect, or_, String, Integer, Float, Boolean, DateTime, Date | |
from sqlalchemy.orm.exc import StaleDataError |
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/python3 | |
# Note: This script has to be in the same directory with sync_po.py (.PO synchronizer). | |
""" | |
Made for combining Django's JavaScript Catalog (translation) implementation with AngularJS templates. | |
Code (AngularJS): | |
----------------- | |
.filter('translate', function() { |