Skip to content

Instantly share code, notes, and snippets.

View gbzarelli's full-sized avatar
Coding...

Guilherme Biff Zarelli gbzarelli

Coding...
View GitHub Profile
@gbzarelli
gbzarelli / HeaderInJAXWS.java
Last active August 20, 2018 12:45
Add SOAP header object using pure JAX-WS
private static IniciarAulaRetorno iniciarAulaPratica(IniciarAulaDados dados) {
MonitAulas service = new MonitAulas();
MonitAulasSoap port = service.getMonitAulasSoap();
BindingProvider bindingProvider = (BindingProvider) port;
Binding binding = bindingProvider.getBinding();
/* For error 307
String WS_URL = "https://renach2.es.gov.br/WebServices/MonitAulasPraticas/MonitAulasPraticas.asmx?wsdl";
Map<String, Object> req_ctx = bindingProvider.getRequestContext();
@gbzarelli
gbzarelli / BuildConfigHelper.kt
Created September 24, 2018 14:09
Arquivo BuildConfig útil para utilização em bibliotecas aonde não tem como pegar as informações do projeto devido ao import. BuildConfig file useful for use in libraries where you can not get project information due to import.
package br.com.grupocriar.swapandroid.utils
import android.content.Context
import java.lang.reflect.Field
object BuildConfigHelper {
val FIELD_DEBUG = "DEBUG"
val FIELD_APPLICATION_ID = "APPLICATION_ID"
val FIELD_BUILD_TYPE = "BUILD_TYPE"
@gbzarelli
gbzarelli / .ScaleGestureDetector.md
Last active October 4, 2018 11:04
Pinch-to-zoom with multi-touch gestures In Android

ScaleGestureDetector

When learning a new concept I don't like using libraries or code dumps. I found a good description here and in the documentation of how to resize an image by pinching. This answer is a slightly modified summary. You will probably want to add more functionality later, but it will help you get started.

Animated gif: Scale image example Layout

The ImageView just uses the app logo since it is already available. You can replace it with any image you like, though.

-- layout.xml

@gbzarelli
gbzarelli / gitlab_docker.md
Last active May 14, 2019 18:03
GitLab with Docker

Create GITLAB (docker-compose.yml):

web:
  image: 'gitlab/gitlab-ce:latest'
  container_name: gitlab
  restart: always
  hostname: 'gitlab.helpdev.com.br'
  environment:
 GITLAB_OMNIBUS_CONFIG: |
@gbzarelli
gbzarelli / .PluginMavenWSDL.md
Last active October 23, 2018 13:29
Como consumir um WSDL com o Maven / Generating a client from WSDL
@gbzarelli
gbzarelli / DebianDisableEnableUI.md
Created November 6, 2018 16:38
Desabilitar / Hanilitar interface grafica no Debian

In order to make text boot the default under systemd (regardless of which distro, really):

systemctl set-default multi-user.target

To change back to booting to the GUI,

systemctl set-default graphical.target

I confirmed those work on my Jessie VM and Slashback confirmed it on Stretch, too.

@gbzarelli
gbzarelli / SHA.java
Created November 22, 2018 17:49
How to get SHA-1 from File
// new FileInputStream(file);
public static String getSHA1(InputStream input) throws
IOException, NoSuchAlgorithmException {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
byte[] buffer = new byte[8192];
int len = input.read(buffer);
@gbzarelli
gbzarelli / .SampleDownloadFileOkHttp.java
Created December 7, 2018 11:46
Exemplo de download de arquivo utilizando OkHttp - Example of file download using OkHttp
import me.tongfei.progressbar.ProgressBar;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SampleDownloadFileOkHttp {
@gbzarelli
gbzarelli / FingerprintTemplate.java
Created December 11, 2018 17:22
Extract minutiae from jpg image with SourcesAFIS (https://sourceafis.machinezoo.com/algorithm)
public static void main(String[] args) throws Exception {
byte[] candidateImage = Files.readAllBytes(Paths.get("/home/gbzarelli/wsq/BA507884721_4.jpg"));
FingerprintTemplate probe = new FingerprintTemplate()
.dpi(500)
.create(candidateImage);
Field immutableField = probe.getClass().getDeclaredField("immutable");
immutableField.setAccessible(true);