Skip to content

Instantly share code, notes, and snippets.

View tporto's full-sized avatar

Thiago Porto tporto

  • Linx
  • Brasil
View GitHub Profile
@tporto
tporto / itens_nf.pas
Last active June 9, 2025 23:10
calculo de imposto nf 4.0
//itens
list_itens := TListNf_itens.Create();
for venda_item in venda_itens do
begin
produto := TProdutoController.getById(venda_item.ID_PRODUTO);
icms := TTributo_icms_ufController.get_by_grupo_uf(produto.ID_GRUPO_TRIBUTARIO, empresa_logado.UF);
ipi := TTributo_ipiController.get_by_grupo(produto.ID_GRUPO_TRIBUTARIO);
pis := TTributo_pisController.get_by_grupo(produto.ID_GRUPO_TRIBUTARIO);
cofins := TTributo_cofinsController.get_by_grupo(produto.ID_GRUPO_TRIBUTARIO);
@tporto
tporto / list.pas
Created May 1, 2018 21:01
list.pas
Criei um orm simples, mas que funciona bem. Nele tenho essa chamada:
class function list(pObjeto: TVO; pFiltro: String): TListaVO;
class function TORM.list(pObjeto: TVO; pFiltro: String): TListaVO;
var
Query: TZQuery;
I, J, K: Integer;
ObjetoLocal: TVO;
Campo, Propriedade, Classe, Caminho, PropriedadeXML, ColunaXML: String;
@tporto
tporto / classe.pas
Created May 1, 2018 20:58
Classe free pascal
unit vo;
{$mode objfpc}{$H+}
interface
uses
TypInfo, SysUtils, Classes, FPJSON, FGL, fpjsonrtti, DOM, XMLRead;
type
@tporto
tporto / perfectelementary.bash
Created March 17, 2018 14:10 — forked from dgleba/perfectelementary.bash
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
#Install Google Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
@tporto
tporto / gist:28742d1498a864c0d709ce7fbeeaff0e
Created February 7, 2018 02:08 — forked from hesoyamcode/gist:d8df3e8761b68a1f25559f59934c03d5
Error:java.util.concurrent.ExecutionException: java.lang.RuntimeException: AAPT process not ready to receive commands Ubuntu 64
Set Env variabel (type in your terminal) or set it on .bashrc or .bash_profile
===============================================================================
export ANDROID_HOME=/home/fuadaip/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
intall if not installed
===============================================================================
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
@tporto
tporto / postgres-cheatsheet.md
Created January 6, 2018 14:02 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@tporto
tporto / tips_elementaryos.txt
Last active September 22, 2017 02:34
tips_elementaryos
Não salvar o último diretório acessado no terminal:
# gsettings set org.pantheon.terminal.settings follow-last-tab false
Alterar a fonte e o tamanho do terminal via dconf:
# org > gnome > desktop > interface > monospace-font-name
Caso tenha problemas com a wifi:
# sudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg- video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial
OR
# sudo apt install bcmwl-kernel-source

My VS CODE SETTINGS

Plugins

  • Django
  • Django Snippets
  • Django Template
  • Easy icon theme
  • Guides(depende da versão)
@tporto
tporto / ubuntu_tips.txt
Last active May 27, 2017 00:46
Ubuntu tips
* Colocar janelas no centro
sudo apt-get install compizconfig-settings-manager
Then open it and go to Window Management > Place Windows, enable it, and in "Placement Mode" choose Centered
* Instalar drivers gráficos proprietários
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get upgrade
* Descompactar arquivos TAR.XZ
import re
"""
Detect browser and it's version.
Now it works only for few moct common browsers. Full list of browsers and
theire user-agent you can find here: http://www.useragentstring.com/pages/useragentstring.php
Version: 0.1
Author: Andrey Nikishaev
Site: http://creotiv.in.ua/