Skip to content

Instantly share code, notes, and snippets.

View giansalex's full-sized avatar

Giancarlos Salas giansalex

View GitHub Profile
@giansalex
giansalex / tesseract-install.sh
Last active May 17, 2020 00:18 — forked from IaroslavR/gist:834066ba4c0e25a27078
Install last tesseract to Amazon Linux from scripts
sudo yum install -y autoconf aclocal automake
sudo yum install -y libtool
sudo yum install -y libjpeg-devel libpng-devel libtiff-devel zlib-devel
cd ~/downloads
wget http://www.leptonica.com/source/leptonica-1.72.tar.gz
tar -zxvf leptonica-1.72.tar.gz
cd leptonica-1.72
./configure
make
sudo make install
@giansalex
giansalex / dotConnect.md
Created February 16, 2018 00:23
Devart dotConnect license executable manually
%Compiler Path%lc /target:myapplication.exe /complist:licenses.licx /i:AssemblyPath/Devart.Data.PostgreSql.dll
@giansalex
giansalex / update-encoding.sql
Created February 22, 2018 20:21
Change encoding existing Postgresql Database
update pg_database set encoding = pg_char_to_encoding('LATIN1') where datname = 'dbname'
@giansalex
giansalex / pg-data-change.md
Last active February 22, 2018 22:57
Change the default PGDATA directory on Windows

PostgreSQL for Windows installs the PGDATA directory by default into C:\Program Files\PostgreSQL\some version\data. This mini-HOWTO explains how to change the default PGDATA directory to another location.

Step 1: Stop The PostgreSQL Service

Close all application that are currently connected to your database, then go to Windows Services Management and stop the PostgreSQL service:
pg services
You should check the task manager to see if any postgresql.exe instances are still running. If so, DO NOT TERMINATE them, instead close all applications that are still connected to the database. Sometimes services like webservers keep persistent connections. In this case you also should stop these services.

Step 2: Change Registry Values

Start the Windows Registry Editor (regedit.exe) and navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pgsql-some version.

SELECT
pg_terminate_backend(procpid)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection!
procpid <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'database_name'
;
@giansalex
giansalex / restore-database.sql
Last active July 13, 2018 22:37
Create Database from SQL Server backup.
USE master;
SET
NOCOUNT ON;
DECLARE @pathBackup VARCHAR (500) = N'C:\User\Files\my_backup.bak'; -- Set your backup path
DECLARE @fileListTable TABLE (
[LogicalName] NVARCHAR(128),
[PhysicalName] NVARCHAR(260),
[Type] CHAR(1),
[FileGroupName] NVARCHAR(128),
[Size] NUMERIC(20, 0),
@giansalex
giansalex / Boleta.xml
Last active March 25, 2024 20:43
Comprobantes Facturación Electrónica SUNAT UBL 2.1 (Factura, Boleta, NCR, NDB, ICBPER, Forma Pago), generados con Greenter https://greenter.dev/
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent />
</ext:UBLExtension>
</ext:UBLExtensions>
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
<cbc:CustomizationID>2.0</cbc:CustomizationID>
<cbc:ID>B001-1</cbc:ID>
@giansalex
giansalex / profile.md
Last active June 2, 2018 03:40
Asp.net profiler tools
@giansalex
giansalex / counter-down.js
Last active June 7, 2018 15:47
CounterDown - Javascript
function format2(value) {
if (value < 10) return '0' + value;
return value;
}
// Set the date we're counting down to
var countDownDate = 3*60000;
var now = 0;
var element = document.getElementById("demo");
@giansalex
giansalex / only-numbers.html
Created August 4, 2018 16:31
HTML Input only Numbers - Jquery
<!DOCTYPE html>
<html>
<body>
<input type="text" sb-numeric>
<input type="text">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function () {
$(document).on("input", "input[sb-numeric]", function() {