Skip to content

Instantly share code, notes, and snippets.

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

Daniel Albuquerque danielAlbuquerque

🏠
Working from home
  • BiziFy
  • São Paulo
View GitHub Profile
@danielAlbuquerque
danielAlbuquerque / GTFROTA.cs
Last active August 27, 2015 16:52
Exception on Connect
static void Main(string[] args)
{
try{
GTFrotaIntegracaoClient client = new GTFrotaIntegracaoClient();
if (client.Autenticar("JSANTANA", "123"))
Console.WriteLine("Acesso autorizado");
else
Console.WriteLine("ACesso negado");
}catch(Exception ex){
Console.WriteLine(ex.Message);
#CORE
group = core
admin-port = 13000
admin-password = playsms
status-password = playsms
log-file = "/var/log/kannel/kannel.log"
log-level = 0
access-log = "/var/log/kannel/access.log"
smsbox-port = 13001
store-type = file
@danielAlbuquerque
danielAlbuquerque / google_drive_util.py
Created February 6, 2017 14:13 — forked from macieksk/google_drive_util.py
A simple Python module to upload files to Google Drive file upload. Needs a file 'client_secrets.json' in the directory . The file can be obtained from https://console.developers.google.com/ -- under APIs&Auth/Credentials/Create Client ID for native application
## Simple Python module to upload files to Google Drive
# Needs a file 'client_secrets.json' in the directory
# The file can be obtained from https://console.developers.google.com/
# under APIs&Auth/Credentials/Create Client ID for native application
# To test usage:
# import google_drive_util
# google_drive_util.login()
# google_drive_util.test()
generatePagesArray: function(currentPage, collectionLength, rowsPerPage, paginationRange)
{
var pages = [];
var totalPages = Math.ceil(collectionLength / rowsPerPage);
var halfWay = Math.ceil(paginationRange / 2);
var position;
if (currentPage <= halfWay) {
position = 'start';
} else if (totalPages - halfWay < currentPage) {
@danielAlbuquerque
danielAlbuquerque / reportSample.prw
Created March 13, 2017 11:35
Exemplo de relatório em ADVPL
#INCLUDE 'protheus.ch'
#INCLUDE 'topconn.ch'
User Function ImpGTRel01()
Private oReport := Nil
Private oSecCab := Nil
Private cPerg := PadR("RCOMR01", Len(SX1->X1_GRUPO))
PutSx1(cPerg,"01","Código de?" ,'','',"mv_ch1","C",TamSx3 ("B1_COD")[1] ,0,,"G","","SB1","","","mv_par01","","","","","","","","","","","","","","","","")
PutSx1(cPerg,"02","Código ate?" ,'','',"mv_ch2","C",TamSx3 ("B1_COD")[1] ,0,,"G","","SB1","","","mv_par02","","","","","","","","","","","","","","","","")
@danielAlbuquerque
danielAlbuquerque / FreespaceTableSpace.SQL
Created March 27, 2017 12:42
Free space in tablespaces
col "Tablespace" for a22
col "Used MB" for 99,999,999
col "Free MB" for 99,999,999
col "Total MB" for 99,999,999
select df.tablespace_name "Tablespace",
totalusedspace "Used MB",
(df.totalspace - tu.totalusedspace) "Free MB",
df.totalspace "Total MB",
round(100 * ( (df.totalspace - tu.totalusedspace)/ df.totalspace))
@danielAlbuquerque
danielAlbuquerque / tstwsrest.prw
Created June 25, 2018 20:53 — forked from vitorebatista/tstwsrest.prw
Exemplo completo webservice REST ADVPL
#include "PROTHEUS.ch"
#include "RESTFUL.ch"
#xtranslate @{Header <(cName)>} => ::GetHeader( <(cName)> )
#xtranslate @{Param <n>} => ::aURLParms\[ <n> \]
#xtranslate @{EndRoute} => EndCase
#xtranslate @{Route} => Do Case
#xtranslate @{When <path>} => Case NGIsRoute( ::aURLParms, <path> )
#xtranslate @{Default} => Otherwise
@danielAlbuquerque
danielAlbuquerque / RemoveEspec.prw
Created August 3, 2018 18:51
Remove caracteres especiais
#INCLUDE "TOTVS.CH"
User Function RemoveEspec(cWord)
cWord := OemToAnsi(AllTrim(cWord))
cWord := FwNoAccent(cWord)
cWord := FwCutOff(cWord)
cWord := strtran(cWord,"ã","a")
cWord := strtran(cWord,"º","")
cWord := strtran(cWord,"%","")
cWord := strtran(cWord,"*","")
@danielAlbuquerque
danielAlbuquerque / Type with Microphone.py
Created January 11, 2019 19:11 — forked from paulohenriquesn/Type with Microphone.py
Type with Microphone with Python
import speech_recognition as sr
from pyautogui import press, typewrite, hotkey
r = sr.Recognizer()
with sr.Microphone() as source:
while True:
try:
audio = r.listen(source)
result = r.recognize_google(audio,language="pt-BR")
@danielAlbuquerque
danielAlbuquerque / Intel01tst.prw
Created January 15, 2019 12:47
Exemplo de integracao com a INTELIPOST
#include 'totvs.ch'
#include "TBICONN.CH"
// EXEMPLO DE CHAMADA DA FUNCAO
User Function Intel01tst()
Local oPedidoEnvio, cPed, oVolume
Local aItens := {}
PREPARE ENVIRONMENT EMPRESA "01" FILIAL "0103" USER "ADMIN" PASSWORD "589@corp" MODULO "FAT"
cPed := "000131"