Skip to content

Instantly share code, notes, and snippets.

View greenled's full-sized avatar
🐺
Winter has come

Juan Carlos Mejías Rodríguez greenled

🐺
Winter has come
View GitHub Profile
@ruanbekker
ruanbekker / promtail_docker_logs.md
Last active March 30, 2024 10:43
Docker Container Logging using Promtail
@dgilge
dgilge / 01_complete_authentication_as_api.md
Created June 15, 2018 11:15
How to implement all needed auth endpoints including login with OAuth2 for a SPA using Django REST framework, django-rest-auth and django-allauth

Complete authentication as API including OAuth2 endpoints

I implemented an auth API for a SPA. This is rarely documented and therefore I want to share here how I did it hoping it will be a help for others.

We are still working on it and I'll update this document accordingly.

This tutorial uses following versions:

Package Version
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active April 9, 2024 16:02
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
@cameronmaske
cameronmaske / encode.py
Last active February 5, 2024 19:16
base64 that actually encodes URL safe (no '=' nonsense)
"""
base64's `urlsafe_b64encode` uses '=' as padding.
These are not URL safe when used in URL paramaters.
Functions below work around this to strip/add back in padding.
See:
https://docs.python.org/2/library/base64.html
https://mail.python.org/pipermail/python-bugs-list/2007-February/037195.html
"""
@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
@mnoble01
mnoble01 / international phone number mask
Last active March 2, 2023 14:03
i18n libphonenumber mask (with in-hand country code)
/*
This is using the JS port of Google's libphonenumber.
As far as I know, though, all of the APIs are the same or similar
*/
// I just hardcoded "US" as the country, but of course you can use any country iso code
var ctry = 'US';
var exampleNumber = i18n.phonenumbers.PhoneNumberUtil.getInstance()
.getExampleNumberForType(ctry, i18n.phonenumbers.PhoneNumberType.MOBILE); // returns PhoneNumber instance