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 / php-background.php
Created January 21, 2018 23:09
Execute $cmd in the background (no cmd window) without PHP waiting for it to finish, on both Windows and Unix.
<?php
function execInBackground($cmd) {
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}
@giansalex
giansalex / ProxySoap.php
Last active September 27, 2023 06:49
Use SoapClient PHP with proxy for HTTP/HTTPS connections
<?php
$parameters = [
'proxy_host' => "127.0.0.1",
'proxy_port' => 8888,
'stream_context' => stream_context_create(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
@giansalex
giansalex / read-file-postgresql.md
Created January 13, 2018 18:59
Read file and insert data to field - PostgreSQL

First

Create function

create or replace function bytea_import(p_path text, p_result out bytea) 
                   language plpgsql as $$
declare
  l_oid oid;
  r record;
begin
 p_result := '';
@giansalex
giansalex / nssm-service.md
Last active July 22, 2020 01:05
Nssm Service Manager Configuration - Run php webserver as Windows Service

Service name is 'PHP001'.

Install

nssm install PHP001

withou GUI

nssm install PHP001 C:\xampp\php\php.exe -S 127.0.0.1:8099
@giansalex
giansalex / docker-php-ext-install.md
Last active October 13, 2024 20:15
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@giansalex
giansalex / docker.md
Last active July 5, 2019 14:30
Docker - steps to publish

Steps

Build

Go DockerFile's directory, run:

docker build -t local/myimage .

Build

StiReport report1 = new StiReport();
report1.RegData(dataSet1);
report1.Load("SimpleList.mrt");
report1.ReportDescription = "Demostracion de lista de clientes";
// Export PDF
report1.Render(false);
report1.ExportDocument(StiExportFormat.Pdf, "my.pdf");
Process.Start("my.pdf");
@giansalex
giansalex / program.cs
Created November 22, 2017 21:08
Magick .Net - Optimize on the fly
using System;
using ImageMagick;
using System.IO;
namespace coreImagick
{
class Program
{
static void Main(string[] args)
{
@giansalex
giansalex / saxon-xsl2-cs.md
Created November 19, 2017 17:24
Saxon c# xslt2 transform
using Saxon.Api;

var xslt = new FileInfo(@"C:\path\to\stylesheet.xslt");
var input = new FileInfo(@"C:\path\to\data.xml");
var output = new FileInfo(@"C:\path\to\result.xml");

// Compile stylesheet
var processor = new Processor();