Skip to content

Instantly share code, notes, and snippets.

View paulonteri's full-sized avatar
💻
Building

Paul Onteri paulonteri

💻
Building
View GitHub Profile
@paulonteri
paulonteri / README.md
Created August 8, 2022 07:51 — forked from denji/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@paulonteri
paulonteri / DjangoKube.md
Created August 6, 2022 11:37 — forked from jjorissen52/DjangoKube.md
Django with Kubernetes

If you are hosting a Django app with Kubernetes, there are a few things that you need to take care of.

Containerizing

Here is a sample Dockerfile for a containerized app:

FROM python:3.9-buster

RUN apt-get update \
    --fix-missing \

Privacy Policy

Last revised on [DATE]

The Gist

[COMPANY] will collect certain non-personally identify information about you as you use our sites. We may use this data to better understand our users. We can also publish this data, but the data will be about a large group of users, not individuals.

We will also ask you to provide personal information, but you'll always be able to opt out. If you give us personal information, we won't do anything evil with it.

@paulonteri
paulonteri / terms_of_service.markdown
Created August 4, 2022 20:55 — forked from sirshurf/terms_of_service.markdown
A general Terms of Service under the Creative Commons License

Terms of Service

Last revised on [DATE]

The Gist

[COMPANY] operates the [SERVICE] service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.

@paulonteri
paulonteri / RichTextEditor.jsx
Created February 17, 2022 06:23
Adding Ckeditor5 to Next JS / React
import React, { useEffect, useRef, useState } from "react";
function Editor({ onChange, editorLoaded, name, value }) {
const editorRef = useRef();
const { CKEditor, ClassicEditor } = editorRef.current || {};
useEffect(() => {
editorRef.current = {
CKEditor: require("@ckeditor/ckeditor5-react").CKEditor, // v3+
ClassicEditor: require("@ckeditor/ckeditor5-build-classic")
@paulonteri
paulonteri / django.yaml
Created January 17, 2022 08:26
Deploy Django to Cloud Run
name: Deploy Backend Production
on:
push:
branches:
- production
paths:
- "backend/**"
workflow_dispatch:
@paulonteri
paulonteri / create_cloudflare_txt_file.py
Last active January 10, 2022 06:28
Used to transer from Google Cloud DNS to Cloudflare DNS. This is after exporting the Google Cloud DNS config to a yaml file.
import yaml
with open("records.yaml", "r") as stream:
with open('cloudflare.txt', 'w+') as cloudflare_file:
docs = yaml.load_all(stream)
for doc in docs:
item = dict(doc.items())
@paulonteri
paulonteri / README.md
Last active May 11, 2022 09:20
Django model cron jobs. Clone of https://djangosnippets.org/snippets/1127

Django model cron jobs

Clone of https://djangosnippets.org/snippets/1127

Author: willhardy Posted: October 11, 2008

Inspired by snippet 1126, I thought I would post a module that stores crontab entries in a database, with a less powerful, but more end-user friendly API. ("twice a week starting on Sat 1 Dec 2007, 6:23am", instead of "23 6,18 * ").

The crontab is synchronised when an entry is changed, and relevant environment variables, function name and arguments are provided. You might want to store this as an app called "scheduler" to match the imports.

@paulonteri
paulonteri / search_suggest_system.py
Created November 20, 2021 10:09
Search Suggestions System
"""
- given: products, searchword
- suggests at most 3 (common prefix)
- after each character is typed
BF: (P.W + P log P) * S
- search arr, get all words with prefix
- sort by lexographic order, return top 3