Skip to content

Instantly share code, notes, and snippets.

View tkrempser's full-sized avatar

Thiago Krempser tkrempser

View GitHub Profile
@tkrempser
tkrempser / allow_cors_get.py
Last active October 19, 2017 17:40
Python function to allow Cross-origin resource sharing from any origin using GET request method.
def allow_cors_get(http_response):
http_response['Access-Control-Allow-Origin'] = "*"
http_response['Access-Control-Expose-Headers'] = "Content-Type"
http_response['Access-Control-Allow-Methods'] = "GET"
http_response['Access-Control-Allow-Headers'] = "Content-Type"
http_response['Access-Control-Allow-Credentials'] = "false"
return http_response
@tkrempser
tkrempser / url_slug.js
Created November 14, 2017 18:21 — forked from sgmurphy/url_slug.js
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
@tkrempser
tkrempser / git_update.sh
Created August 29, 2021 01:56
Update Git to the latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt update && sudo apt-get install git -y
@tkrempser
tkrempser / .platform:hook:postdeploy:01_create_celery_service.sh
Created February 22, 2023 18:01 — forked from MahirMahbub/.platform:hook:postdeploy:01_create_celery_service.sh
Config for AWS Beanstalk Linux 2 Django Celery Deployment with Amazon SQS
#!/usr/bin/env bash
# Create the celery systemd service file
echo "[Unit]
Name=Celery
Description=Celery service for __
After=network.target
StartLimitInterval=0
[Service]
@tkrempser
tkrempser / celery_configs
Created February 22, 2023 18:02 — forked from Alex3917/celery_configs
How to configure Celery using Elastic Beanstalk with Amazon Linux 2
# In .ebextensions/01_celery.config
files:
"/etc/systemd/system/celery.service":
mode: "000644"
owner: celery
group: celery
content: |
[Unit]
Description=Celery Service