Skip to content

Instantly share code, notes, and snippets.

@merong
merong / OCR.java
Created May 12, 2017 12:34 — forked from christianroman/OCR.java
Captcha OCR + Tesseract
public class OCR {
private static final String INPUT = "C:/captcha/ex.png";
private static final String OUTPUT = "C:/captcha/captcha-out.png";
private static final String TESSERACT_BIN = "C:/Program Files/Tesseract-OCR/tesseract.exe";
private static final String TESSERACT_OUTPUT = "C:/captcha/out.txt";
private static final int WHITE = 0x00FFFFFF, BLACK = 0x00000000;
public static void main(String... args) throws Exception {
BufferedImage image = ImageIO.read(new FileInputStream(INPUT));
int average = 0;
@merong
merong / gist:f92faf9a06d1347c65b09eaa59173abf
Created October 15, 2017 04:05 — forked from moneytoo/gist:8c95cc39fd4fd9a18858eb15e379d2f5
ImageMagick 6.7.8 with WebP (libwebp) support on CentOS 7
yum -y install bzip2-devel libtiff-devel giflib-devel ghostscript-devel libwmf-devel jasper-devel libtool-ltdl-devel libXext-devel libXt-devel librsvg2-devel OpenEXR-devel libwebp-devel
rpm -ivh http://vault.centos.org/centos/7/updates/Source/SPackages/ImageMagick-6.7.8.9-15.el7_2.src.rpm
sed -i '/BuildRequires:\tghostscript-devel/a BuildRequires:\tlibwebp-devel' /root/rpmbuild/SPECS/ImageMagick.spec
sed -i '/Requires: pkgconfig/a Requires: libwebp' /root/rpmbuild/SPECS/ImageMagick.spec
rpmbuild -ba /root/rpmbuild/SPECS/ImageMagick.spec
# actual install
rpm -Uvh --force /root/rpmbuild/RPMS/x86_64/ImageMagick-6.7.8.9-15.el7.centos.x86_64.rpm
@merong
merong / sphinx.conf
Created December 16, 2017 15:40 — forked from dougmorato/sphinx.conf
Sample sphinx.conf file to index Tryton product name and description
#
# Sphinx configuration file sample
#
# Please refer to doc/sphinx.html for details.
#
#############################################################################
## data source definition
#############################################################################
@merong
merong / README.md
Created April 24, 2018 11:45 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@merong
merong / HTML: HTML5 Default Template
Created August 31, 2018 04:17 — forked from fakiolinho/HTML: HTML5 Default Template
HTML: HTML5 Default Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<!-- Favicons Start -->
<!-- In case image.ico -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
@merong
merong / nginx.conf
Created January 18, 2020 10:40 — forked from CSRaghunandan/nginx.conf
Nginx configuration for serving mp4 videos
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@merong
merong / SimpleXMLElement-node-existence.php
Created June 11, 2021 02:53 — forked from Thinkscape/SimpleXMLElement-node-existence.php
How to check if a <child> node exists in SimpleXMLElement document ? Comparison of different approaches.
<?php
/**
* The only reliable way of determining if a child exists
* in SimpleXMLElement is to use count(). All other methods
* do not work reliably in global or local NS.
*
* NOTE: Error suppresion on @count() is used to suppress
* "PHP Warning: count(): Node no longer exists"
*/
if(!class_exists('SimpleXMLElement')) die("Bonkers");
#!/bin/sh
# install stable nginx
# even though nginx will be replaced
# by compiling from source
# this installs latest versions
# of required libs
add-apt-repository -y ppa:nginx/stable \
&& apt-get update \
&& apt-get install -y nginx \
@merong
merong / nginx-tuning.md
Created April 15, 2022 07:35 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@merong
merong / PDFTableStripper.java
Created July 19, 2022 19:25 — forked from beldaz/PDFTableStripper.java
Class to extract tabular PDF text using PDFBox
/*
* Copyright 2017 Beldaz (https://github.com/beldaz)
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0