Skip to content

Instantly share code, notes, and snippets.

View ronnycoding's full-sized avatar
🇻🇪
The only way to do great work is to love what you do.

Ronny Freites ronnycoding

🇻🇪
The only way to do great work is to love what you do.
View GitHub Profile
@ronnycoding
ronnycoding / php-docker-ext
Created February 27, 2021 22:59 — forked from hoandang/php-docker-ext
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
@ronnycoding
ronnycoding / vscode_shortcuts.md
Created November 28, 2020 18:53 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@ronnycoding
ronnycoding / _config.scss
Created August 21, 2020 02:56 — forked from michsch/_config.scss
Font size configuration with Sass (SCSS)
/* font size & line height in px */
$font-size-body-px: 14;
$line-height-px: 21;
/* calculate font-size (in %) and line-height (in em) */
$font-size-body: pc($font-size-body-px, 16);
$line-height: em($line-height-px, $font-size-body-px);
@ronnycoding
ronnycoding / docker_debugging.md
Created July 4, 2020 21:13 — forked from veuncent/docker_debugging.md
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this:
@ronnycoding
ronnycoding / graphql_test_utils.py
Created June 7, 2020 02:45 — forked from Glyphack/graphql_test_utils.py
functions to test graphql api with python
from django.contrib.auth.models import AnonymousUser
from django.test import RequestFactory
from snapshottest.django import TestCase
from graphene.test import Client
from hackernews.schema import schema
class APITestCase(TestCase):
def setUp(self):
@ronnycoding
ronnycoding / README.md
Created May 7, 2020 05:17 — forked from eunomie/README.md
How to send containers log to ELK using gelf log driver

Send docker logs to ELK through gelf log driver

There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.

But docker has a gelf log driver and logstash a gelf input. So here we are.

Here is a docker-compose to test a full elk with a container sending logs via gelf.

@ronnycoding
ronnycoding / PyJWT_authentication_routes.py
Created May 3, 2020 03:51
PyJWT Authentication routes Anonymous/Authenticated users
from rest_framework.decorators import api_view
from django.http import JsonResponse
from rest_framework.authtoken.views import ObtainAuthToken
from app.auth_helper.authenticator import Authenticator
class CustomAuthToken(ObtainAuthToken):
def post(self, request, *args, **kwargs):
serializer = self.serializer_class(data=request.data,
@ronnycoding
ronnycoding / utils.py
Created May 3, 2020 03:48
util function to get env variable on Django
import os
from django.core.exceptions import ImproperlyConfigured
def get_env_value(env_variable):
try:
return os.environ[env_variable]
except KeyError:
error_msg = 'Set the {} environment variable'.format(env_variable)
raise ImproperlyConfigured(error_msg)
@ronnycoding
ronnycoding / PyJWT.py
Created May 3, 2020 03:46
PyJWT example
import jwt
import datetime
from app.utils.utils import get_env_value
class Authenticator:
CHARSET = 'utf-8'
ALGORITHM = 'RS256'
TOKEN_TIME_DAYS = 15
CLAIMS = {
@ronnycoding
ronnycoding / jwtRS256.sh
Created May 2, 2020 02:39 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub