Skip to content

Instantly share code, notes, and snippets.

View claytonaalves's full-sized avatar

Clayton A. Alves claytonaalves

View GitHub Profile
@claytonaalves
claytonaalves / ACBrTEFAPIElginComum.pas
Created January 10, 2025 18:15
Correção para vazamento de memória no TEF Elgin
{******************************************************************************}
{ Projeto: Componentes ACBr }
{ Biblioteca multiplataforma de componentes Delphi para interação com equipa- }
{ mentos de Automação Comercial utilizados no Brasil }
{ }
{ Direitos Autorais Reservados (c) 2024 Daniel Simoes de Almeida }
{ }
{ Desenvolvido por: MuriloS.A e Fernando Pasqueto }
{ }
{ Você pode obter a última versão desse arquivo na pagina do Projeto ACBr }
@claytonaalves
claytonaalves / setenv.cmd
Last active January 14, 2021 14:28
Set windows terminal path environment according to param
@echo off
if "%1"=="" (
echo Informe o ambiente desejado:
echo.
echo tcc - Tiny C
echo msvc - Microsoft C++
echo fpc - FreePascal
echo d7 - Delphi 7
echo d10 - Delphi 10
@claytonaalves
claytonaalves / iagente.py
Created December 20, 2017 01:20
Endpoint falso para simular o gateway de sms Zenvia porém enviando pelo Iagente
#!/bin/env python
# encoding: utf8
import cgi
import urllib
import urllib2
def send_sms(to, msg):
url = 'http://www.iagentesms.com.br/webservices/http.php'
payload = {
@claytonaalves
claytonaalves / y.pyw
Last active August 11, 2017 14:39
Youtube browser controller
import sys
import socket
import tempfile
STATE_FILE = tempfile.gettempdir() + '/youtube-state.txt'
def play_or_pause_video():
current_state = get_current_state()
command = {'playing': 'pause', 'paused': 'play'}[current_state]
browser_command("document.getElementsByTagName('video')[0].{0}()".format(command))
@claytonaalves
claytonaalves / backup.bat
Created October 3, 2015 19:57
MySQL backup batch script
REM This batch script requires command line verson of 7zip to work.
REM
REM Command to create windows task schedule:
REM
REM schtasks /create ^
REM /tn "MySQL Backup" ^
REM /tr C:\script_folder\backup.bat ^
REM /sc DAILY ^
REM /sd 03/10/2015 ^
REM /st 13:45
@claytonaalves
claytonaalves / .gitconfig
Last active September 24, 2015 11:33
My custom .gitconfig
[user]
name = Clayton
email = [email protected]
[alias]
st = status
ci = commit
lg = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
changelog = log --pretty=format:'- %s <%an>' --abbrev-commit
co = checkout
@claytonaalves
claytonaalves / mysqllog.sh
Created July 3, 2012 23:39
Real-time MySQL query log analyzer with source highlight
#!/bin/bash
# Author : Clayton A. Alves
# License : I don't care...
# Date : 2012-06-06
#
# Real-time MySQL query log analyzer with source highlight
# (displays executed queries colorized on screen)
#
# Requires:
@claytonaalves
claytonaalves / checkrad_bash.sh
Created January 12, 2012 17:00
Simple checkrad freeradius bash script
#!/bin/bash
if [ $# -eq 0 ]; then
echo Uso: checkrad nas_type nas_ip nas_port login session_id
exit 1
fi
function checa {
if [ $? -eq 0 ]; then
data=$(date +"%d/%m/%Y %H:%M:%S")
echo "$data - Usuário '$username' já está conectado em $nas" >> /var/log/radius/checkrad.log
@claytonaalves
claytonaalves / splitGigaword.py
Created July 23, 2011 00:05
Split one Gigaword into twho Quadwords
"""
Conversion calculation for finding Mikrotiks radius attributes.
Ex:
Mikrotik-Recv-Limit
Mikrotik-Recv-Limit-Gigawords
"""
def splitvalues(gigaword):
quadwordA = gigaword & 4294967295
@claytonaalves
claytonaalves / retry_decorator.py
Created December 8, 2010 13:06 — forked from hoffmann/retry_decorator.py
Decorator para setar numero de execuções de uma função
import time
class Retry(object):
default_exceptions = (Exception)
def __init__(self, tries, exceptions=None, delay=0):
"""
Decorator for retrying function if exception occurs
tries -- num tries
exceptions -- exceptions to catch