Skip to content

Instantly share code, notes, and snippets.

View devwebcl's full-sized avatar

German Gonzalez-Morris devwebcl

View GitHub Profile
   for(int i=0 ; i < 5 ; i++)
   {
      System.out.println("i is : " + i);
   }
@devwebcl
devwebcl / TestMagicHeader.java
Last active September 22, 2020 22:04
Apache Tika sample
package cl.ejemplo.mimetypes;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
public interface Step<T> {
T process(T input) throws ExecutionException;
}
public class Pipeline<T> {
private final List<Step<T>> steps;
#!/usr/bin/python
import sys
import os
import stashy
# http://bitbucket:7990/projects/TBP/
# python get.py TBP :
stash = stashy.connect("http://test.server.cl:7990/", "german.gonzalez", "welcome1")
for repo in stash.projects[sys.argv[1]].repos.list():
public static String refactoringJson(String body) {
// limpiar los valores nulos que con unirest kong se llaman nULLValue :/
Gson gson = new Gson();
Map<String, Map<String, String>> mapBody = gson.fromJson(body, Map.class);
Map<String, String> jsonLimpio = new HashMap();
// recorrer mapa y limpiar
for (Map.Entry entryBody : mapBody.entrySet()) {
package cl.ejemplo.json.schema;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.everit.json.schema.Schema;
import org.everit.json.schema.loader.SchemaLoader;
import org.json.JSONObject;
import org.json.JSONTokener;
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id_schema": "1",
"title": "Journal nuevo",
"description": "persistencia en el modelo de Journal",
"version": "1.0.0",
"type": "object",
"definitions": {
"dataAuditoria": {
<dependency>
<groupId>com.doctusoft</groupId>
<artifactId>json-schema-java7</artifactId>
<version>1.4.1</version>
</dependency>
@devwebcl
devwebcl / pthreads-p339.c
Last active December 5, 2020 15:28
threads c11
#include <pthread.h>
#include <stdio.h>
int *dowork(void *arg)
{
pthread_t mythreadid = pthread_self();
for (int i = 0; i < 5; i++) {
printf("Thread id: %lu, counter: %d, code: %s\n", mythreadid, i, (char *)arg);
}
@devwebcl
devwebcl / Cliente.java
Created January 14, 2021 12:25
pojo with copy constructor and clone()
package cl.devweb.constructor;
public class Cliente implements Cloneable {
int rut;
String nombre;
Cliente(int rut, String nombre) {
this.rut = rut;
this.nombre = nombre;