Skip to content

Instantly share code, notes, and snippets.

@oleoneto
oleoneto / nginx.conf
Last active October 1, 2020 11:16 — forked from asmallteapot/nginx.conf
Generic Nginx configuration for serving Django projects [updated]
# file: /etc/nginx/sites-available/example.com
# nginx configuration for example.com
server {
listen 80;
server_name example.com;
access_log /var/www/example.com/logs/access.log;
error_log /var/www/example.com/logs/error.log;
# pass root to django
@oleoneto
oleoneto / nginx-SSL.conf
Last active March 8, 2021 20:39
Generic Nginx configuration for serving Django projects over SSL
# Configuration assumes use of Let's Encrypt
# Site is ONLY served through HTTPS.
# Site is served through .example.com and www.example.com
# Leo N.
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
#
# Wide-open CORS config for nginx
# From: https://enable-cors.org/server_nginx.html
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
@oleoneto
oleoneto / cdnimports.md
Last active October 9, 2018 15:39
Libraries and frameworks I use.

Libraries and Frameworks

CSS

<!-- Normalize css -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">

<!-- Google Fonts: Source Sans Pro and Open Sans -->
@oleoneto
oleoneto / startsite.sh
Last active August 15, 2017 02:15
Automating the creation of a new project site directory.
#!/bin/bash
# Get name of the site directory
# Create index.html
# Create css, js, and img sub-directories
# Create css and js files inside the respective folders
# Usage: ./startsite.sh SITE_PROJECT_NAME
# Tradução [Português]
# SITE vai armazenar o nome do argumento passado por meio do terminal. Esse nome será o nome do directório.
# Depois de criar o directório, entrasse no mesmo para a criação das pastas necessárias: CSS, JS, and IMG...
@oleoneto
oleoneto / djangoproject.sh
Created August 14, 2017 22:24
A handy script for creating Django Projects and their respective applications.
#!/bin/bash
# Usage: ./djangoproject.sh PROJECT_NAME APP_NAME1 APP_NAME2 APP_NAME3
# This script is written to handle up to three(3) applications. It can definitely be extended further...
SITE=$1
firstapp=$2
secondapp=$3
thirdapp=$4
@oleoneto
oleoneto / djangoproject.sh
Last active December 22, 2017 21:27
Updated version of the shell script to automate the creation of Django projects with their respective apps. This script also initializes a local git repository.
#!/bin/bash
# Requirements: Python3.6, Django and Git
# A handy script for creating Django Projects and their respective applications
# Usage: ./djangoproject.sh PROJECT_NAME APP_NAME1 APP_NAME2 APP_NAME3 APP_NAME4
SITE=$1
firstapp=$2
secondapp=$3
thirdapp=$4
fourthapp=$5
@oleoneto
oleoneto / EventBrite.py
Last active November 26, 2017 03:43
An implementation of the EventBrite API. Requires Python 3+, Internet, and an EventBrite API Key.
"""
EventBrite.py
By Leo N.
An implementation of the EventBrite API.
Requirements: Python 3+, Internet, EventBrite API Key.
--------------------
Structure of the JSON for an event object:
@oleoneto
oleoneto / newbottleapp.sh
Created December 22, 2017 20:49
A script that automates the creation of a directory for a bottle app.
#!/bin/bash
# Requirements: Python, Bottle
# A script that automates the creation of a bottle app.
SITE=$1
print_usage(){
echo "usage: newbottle [appname]"
echo " newbottle -h"
echo " newbottle -st"
@oleoneto
oleoneto / newsite.sh
Last active December 22, 2017 21:28
Generates a directory with all the required starter files for an HTML-based site project.
#!/bin/bash
# Requirements: No special requirements.
# Usage: ./newsite.sh NAME_OF_SITE
SITE=$1
HELP="-h"
print_usage(){
echo "usage: newsite [nameofsite]"
echo " newsite -h"