Skip to content

Instantly share code, notes, and snippets.

@xcdr
xcdr / auth0_django_middleware.py
Created March 27, 2019 14:03 — forked from bholagabbar/auth0_django_middleware.py
Auth0 Token Validation and Authorisation as Django Middleware
from django.http import JsonResponse
from jose import jwt
AUTH0_DOMAIN = {YOUR_AUTH0_DOMAIN}
API_AUDIENCE = {YOUR_API_AUDIENCE}
ALGORITHMS = ["RS256"]
"""
Cache the key available at https://{AUTH0_DOMAIN}/.well-known/jwks.json as a python dict
@xcdr
xcdr / tmux-cheatsheet.markdown
Created June 1, 2017 12:11 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@xcdr
xcdr / nginx.conf
Created May 26, 2017 07:17 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@xcdr
xcdr / rails http status codes
Created December 6, 2016 13:38 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@xcdr
xcdr / reset.sh
Last active January 11, 2016 12:07
Reset hostname and sshd for vm-template.
#!/bin/sh
find /var/log -name *.gz -print -delete
find /var/log -name *.log-* -print -delete
SRC_HOSTNAME='vm-template'
DST_HOSTNAME='vm-hostname'
sed -i'' -e"s/${SRC_HOSTNAME}/${DST_HOSTNAME}/g" /etc/hostname
sed -i'' -e"s/${SRC_HOSTNAME}/${DST_HOSTNAME}/g" /etc/hosts
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
apt-get -y install libcurl4-openssl-dev
apt-get -y install libffi-dev
apt-get -y install libgmp-dev
apt-get -y install libreadline-dev
apt-get -y install libssl-dev