Skip to content

Instantly share code, notes, and snippets.

#
# 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 / 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 / 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 / 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 / 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 / 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"
int A = 12;
// B is a pointer to the address of A
int *B = &A;
// C is a nickname for A, or a reference to A
// If either A or C change, both will change.
int &C = A;
C=99;
# message.html
<form class="form" action="{% url 'validate' %}" id="" method="POST">
{% comment %} csrf_token must be added for security reasons {% endcomment %}
{% csrf_token %}
<div class="form-group">
<label for="emailLabel">Email address</label>
<input name="email" type="email" class="form-control"
id="email" aria-describedby="emailLabel" placeholder="Email Address">
</div>
cardArray = [0] * 52
names = ["Oliver", "James", "Rui", "Ricky", "Paul"]
def setCardArrayToZero():
print("Array before:")
print(cardArray)
for index in range(5):
cardArray[index] = 0