Skip to content

Instantly share code, notes, and snippets.

View mayronceccon's full-sized avatar

Mayron Ceccon mayronceccon

View GitHub Profile
@douglascabral
douglascabral / jwt.php
Last active July 25, 2023 03:44
Example of JWT with Pure PHP
<?php
$key = 'your-secret-key-here';
$header = [
'typ' => 'JWT',
'alg' => 'HS256'
];
$header = json_encode($header);
$header = base64_encode($header);
@martync
martync / aggregate_tags.py
Created April 29, 2013 09:10
Django aggregation in template filters.
from django import template
from django.db.models import Sum, Avg, Max, Min, Count
register = template.Library()
@register.filter
def sum(queryset, field):
return queryset.aggregate(sum_value=Sum(field)).get('sum_value')
@aalvesjr
aalvesjr / gist:2041706
Created March 15, 2012 03:31
Entendendo as permissões [linux]
Entendendo as permissões
Usa-se muito o chmod e pouco fala-se dele.
Muitas vezes a pessoa não sabe o que está fazendo quando dá uma permissão 777 ou 455 para um arquivo. Vou explicar mais a fundo o funcionamento do chmod.
Um 'ls -la' no Linux tem o seguinte output:
drwxr-xr-x 2 root root 4096 Set 22 10:08 temp
-rwxrwxr-x 1 garcia garcia 1088 Jul 5 16:17 torpedo
-rw-rw-r-- 1 garcia garcia 18283 Ago 3 13:10 videoteca.tar.gz