Skip to content

Instantly share code, notes, and snippets.

View ricdex's full-sized avatar
🎯
Focusing

Ricardo Avila ricdex

🎯
Focusing
  • BCP
  • Peru
View GitHub Profile
@ricdex
ricdex / tomcat_autorestart.sh
Created March 19, 2020 21:52
Iniciar proceso de tomcat si no existe
#!/bin/sh
output=$(ps h -C java -o "%p:%a" | grep catalina | cut -d: -f1)
if [ -z $output ]; then
echo "$(date) - Process not found, need to start"
/opt/tomcat/bin/startup.sh
else
echo "$(date) - Process found, no need to start"
fi
@ricdex
ricdex / .gitignore
Created June 22, 2016 17:47 — forked from keyboardsurfer/.gitignore
Android gitignore
# Copyright: Benjamin Weiss (keyboardsurfer) https://github.com/keyboardsurfer
# Under CC-BY-SA V3.0 (https://creativecommons.org/licenses/by-sa/3.0/legalcode)
# built application files
*.apk
*.ap_
*.jar
!gradle/wrapper/gradle-wrapper.jar
# lint folder
/**
* Copyright 2016 Erik Jhordan Rey.
* <p>
* Licensed 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
@ricdex
ricdex / gist:fa9c8c6749f140d75b44
Created March 28, 2016 20:16
SSEmiter con Android
private void startClient() throws InterruptedException {
EventSource es = new EventSource(URI.create("http://192.168.1.43:8080/helloCount"), new EventSourceHandler() {
@Override
public void onConnect() {
System.out.println("CONNECTED");
}
@Override
public void onMessage(String event, MessageEvent message) {
@ricdex
ricdex / gist:39ac3f9c6ec2094711ed
Created March 28, 2016 20:02
SseEmitter con Spring
@RequestMapping("/helloCount")
SseEmitter mine() {
final SseEmitter sseEmitter = new SseEmitter();
Observable.just(1,2,3,4,5,6,7,8,9,10)
.map(t -> t + t)
.observeOn(Schedulers.computation())
.subscribe(new Subscriber<Integer>() {
@ricdex
ricdex / modificar imagen
Created March 18, 2016 14:50
Modificar imagen en android para que pese menos
BitmapFactory.Options options1 = new BitmapFactory.Options();
options1.inSampleSize = 5;
Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.mapa0x, options1);
BitmapDescriptor descriptor1 = BitmapDescriptorFactory.fromBitmap(bitmap1);
@ricdex
ricdex / animar un atributo
Created March 18, 2016 14:49
Un atributo (margin, padding) animado en el tiempo para android
ValueAnimator varl = ValueAnimator.ofInt(150);
varl.setDuration(400);
varl.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float d = mRecyclerView.getContext().getResources().getDisplayMetrics().density;
int padding = 0; // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(mGroundOverlay.getBounds(), padding);
mMap.animateCamera(cu);
@ricdex
ricdex / playbook-install-jdk8.yml
Created January 13, 2016 16:42 — forked from andershedstrom/playbook-install-jdk8.yml
Ansible playbook for installing Oracle Java 8 on CentOS
---
- hosts: app
remote_user: vagrant
sudo: yes
vars:
download_url: http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
download_folder: /opt
java_name: "{{download_folder}}/jdk1.8.0_05"
java_archive: "{{download_folder}}/jdk-8u5-linux-x64.tar.gz"