Skip to content

Instantly share code, notes, and snippets.

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

Breno Martinusso martinusso

🏠
Working from home
View GitHub Profile
@martinusso
martinusso / Dynamic.pas
Created June 6, 2012 17:58
Delphi and dynamic characteristics
unit Dynamic;
interface
uses
Variants;
type
TDynamic = class
public
@martinusso
martinusso / RecordAsAProperty.pas
Created June 13, 2012 13:06
"Left Side Cannot Be Assigned To" Compile Time Delphi Error
{interface}
type
TInnerRecord = record
Value: string;
end;
TClassA = class
public
InnerRecord: TInnerRecord;
@martinusso
martinusso / rotate_table.html
Created October 22, 2012 17:21
rotate table
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>teste som</title>
<style type="text/css">
body{margin-top: 200px}
table {border: 1px solid red;}
table td {border: 1px solid blue;}
#notas {
@martinusso
martinusso / select_domains_firebird.sql
Created August 9, 2013 20:01
select domains - Firebird
SELECT
RDB$FIELDS.RDB$FIELD_NAME
FROM
RDB$FIELDS
INNER JOIN RDB$RELATION_FIELDS
ON (RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME)
WHERE
RDB$FIELDS.RDB$SYSTEM_FLAG = 0
GROUP BY
RDB$FIELDS.RDB$FIELD_NAME
@martinusso
martinusso / dynamic_ip.bat
Last active April 16, 2019 05:52
Configuring ip on Windows with command line. The requested operation requires elevation (Run as Administrator)
netsh interface ip set address name="CONNECTION_NAME" dhcp
netsh interface ip set dns name="CONNECTION_NAME" 8.8.8.8
netsh interface ip set dns name="CONNECTION_NAME" 8.8.4.4
@martinusso
martinusso / installed_apps.pas
Last active April 16, 2019 05:51
Looking for installed applications on Windows using Delphi
program InstalledApps;
{$APPTYPE CONSOLE}
uses
Windows,
Classes,
SysUtils,
Registry;
@martinusso
martinusso / change_extension.py
Last active August 29, 2015 13:55
Script to change the extension of multiple files in a directory with Python. [pt-br: Script para mudar a extenção de multiplos arquivos usando Python]
#!/usr/bin/python
# coding: utf-8
import os
OLD_EXT = '.rar' # Change here for the old extension
NEW_EXT = '.cbr' # Change here for the new extension
CURRENT_DIR = os.getcwd()
def main():
@martinusso
martinusso / update_value_generators.sql
Created February 11, 2014 13:57
update generators values ​​according to the primary key field.
execute block
as
declare variable trigger_name varchar(32);
declare variable table_name varchar(32);
declare variable generator_name varchar(32);
declare variable last_id integer;
declare variable sql varchar(100);
declare variable pk_field_name varchar(32);
begin
for
@martinusso
martinusso / find_primary_key.sql
Last active November 10, 2018 10:58
Playing with Firebird System Tables
-- [en] select primary key field of all tables
-- [pt] selecionar o campo primary key das tabelas
select
i.rdb$index_name,
s.rdb$field_name
from
rdb$indices i
left join rdb$index_segments s on i.rdb$index_name = s.rdb$index_name
left join rdb$relation_constraints rc on rc.rdb$index_name = i.rdb$index_name
@martinusso
martinusso / Modulus11.cs
Created April 29, 2014 14:38
Check Digit based on modulo 11 - c#
public class Modulus11
{
public string GetCheckDigit(string number)
{
int sum = 0;
for (int i = number.Length - 1, multiplier = 2; i >= 0; i--)
{
sum += (int)char.GetNumericValue(number[i]) * multiplier;
if (++multiplier > 9) multiplier = 2;
}