Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
View GitHub Profile
@rg3915
rg3915 / .git_config
Last active February 27, 2019 02:09
git config username define
[user]
username = rg3915
email = rg3915 yahoo
@rg3915
rg3915 / unicode.md
Created March 22, 2019 20:34
unicode encode decode Python 2
@rg3915
rg3915 / github-icon.png
Last active March 25, 2019 00:03
email signature
github-icon.png
@rg3915
rg3915 / vuejs.md
Last active March 25, 2019 00:31
VueJS Tips select option month default value mês

Pega mês atual

<select class="form-control" v-model="month_selected">
  <option v-for="month in months" :value="month.value">${ month.label }</option>
</select>

data: {
  month_selected: '',
 months: [
@rg3915
rg3915 / regex.md
Created March 26, 2019 16:44
regex anotações annotations
.   ponto
[]  lista
[^] lista negada
?   opcional
*   asterisco
+   mais
{}  chaves
^   circunflexo
$ cifrão
@rg3915
rg3915 / README.md
Last active April 8, 2019 02:26
Lendo txt e reagrupando itens para virar um JSON
@rg3915
rg3915 / weekday.py
Created April 13, 2019 18:40
Python Switch Case
def dia_da_semana(day):
if day == 1:
dia = 'Domingo'
elif day == 2:
dia = 'Segunda'
elif day == 3:
dia = 'Terça'
elif day == 4:
dia = 'Quarta'
elif day == 5:
@rg3915
rg3915 / django_orm_optimization_cheat_sheet.py
Last active August 26, 2023 15:51 — forked from levidyrek/django_orm_optimization_cheat_sheet.py
Django ORM optimization cheat sheet
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@rg3915
rg3915 / draw.md
Last active May 1, 2020 04:15
Imagemagick draw line on image
convert teste.png -strokewidth 1 -stroke red -draw "line 0,400 1200,400, line 600,0 600,800" teste_out.png

mogrify -strokewidth 1 -stroke red -draw "line 0,400 1200,400, line 600,0 600,800" *.png

convert teste.png -pointsize 75 -fill white -draw "text 460,290 '#00'" teste00.png

convert -size 1000x600 xc:skyblue -fill white -stroke black -draw "rectangle 200,100 800,500" draw_rect.png

convert -size 300x500 xc:none -stroke black -strokewidth 1 -fill blue -draw "rectangle 0,100 200,300" -draw "ellipse 100,300 100,50 0,180" -draw "ellipse 100,100 100,50 0,360" cilindro.png; eog cilindro.png
@rg3915
rg3915 / example_current_user.py
Last active April 29, 2025 17:37 — forked from vinidmpereira/example_current_user.py
get_current_user middleware. current user
"""
This should be a separate file, i usually install it on the maind django project folder.
"""
from threading import local
from django.utils.deprecation import MiddlewareMixin
_user = local()