import math
s = 'Sample text'
import decimal
dn = decimal.Decimal(math.pi) # a decimal number
fn = math.pi # a float number
print (f'{s}')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes | |
] | |
STATUS_CODE = { | |
100: "Continue", | |
101: "Switching Protocols", | |
102: "Processing", | |
103: "Checkpoint", | |
122: "Request-URI too long", | |
200: "OK", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet"> | |
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"> | |
</head> | |
<body> | |
<div id="app"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet"> | |
<link href="https://unpkg.com/vuetify/dist/vuetify.min.css" rel="stylesheet"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"> | |
</head> | |
<body> | |
<div id="app"> | |
<v-app id="inspire"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', | |
URL: http://localhost:8080/api/v1/project/?limit=2&offset=2 | |
Result | |
----- | |
>> 7 reg total | |
``` | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pyton3 | |
# django2.1 | |
import os | |
from django.apps import apps | |
from django.conf import settings | |
def get_templates_directories(): | |
template_directories = [] | |
# Getting templates in the templates directory | |
for template in settings.TEMPLATES: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// formato da planilha | |
// Colunas | |
//Moderadores | dia inicio | duracao | titulo | palestrante | link | mail | data_inicio | data_fim | calendar.object.id | |
// conteudo a partir da linha 10 ou altere alinha | |
// ... var slots = sps.getRange("agenda-calendario!A10:K"+last_row+"").getValues(); | |
// para | |
// ... var slots = sps.getRange("<NOME_SHEET>!A10:K"+last_row+"").getValues(); | |
function slots_2_calendar() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from osgeo import gdal, ogr | |
from PIL import Image, ImageDraw | |
# Filename of input OGR file | |
vector_fn = 'RG2017_rgi_centroids.shp' | |
# Open the data source and read in the extent | |
datasource = ogr.Open(vector_fn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onOpen() { | |
var ui = DocumentApp.getUi(); | |
ui.createMenu('Convert to .RST') | |
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText') | |
.addToUi(); | |
} | |
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini | |
// License: Apache License Version 2.0 | |
String.prototype.repeat = String.prototype.repeat || function(num) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "convert"or transform a Json to objet attributes | |
# converte ou transforma um Json em objeto com atributos | |
def _json_object_hook(d:Dict): | |
return namedtuple('X', d.keys(), rename=True)(*d.values()) | |
def json2obj(data_json: str): | |
return json.loads(data_json, object_hook=_json_object_hook) |
OlderNewer