Skip to content

Instantly share code, notes, and snippets.

View pedrodonte's full-sized avatar
💭
Coding...

Pedro Carrasco pedrodonte

💭
Coding...
  • JSoft Labs
  • Santiago
  • 21:41 (UTC -04:00)
View GitHub Profile
import cv2
def draw_text(img, text,
font=cv2.FONT_HERSHEY_PLAIN,
pos=(0, 0),
font_scale=3,
font_thickness=2,
text_color=(0, 255, 0),
text_color_bg=(0, 0, 0)
):
create or replace PROCEDURE get_emp_rs (p_deptno IN emp.deptno%TYPE,
p_recordset OUT SYS_REFCURSOR) AS
BEGIN
OPEN p_recordset FOR
SELECT emp.ename,
emp.empno,
emp.JOB,
emp.SAL
FROM EMP emp inner join dept dept on (emp.DEPTNO = dept.DEPTNO)
WHERE emp.deptno = p_deptno
@pedrodonte
pedrodonte / GeneradorReporteController.java
Last active January 12, 2016 20:01
Generación de reporte Jasper mediante JSF ActionListener
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@pedrodonte
pedrodonte / CookieHelper.java
Created December 30, 2015 05:38
CookieHelper
public class CookieHelper {
public void setCookie(String name, String value, int expiry) {
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
Cookie cookie = null;
Cookie[] userCookies = request.getCookies();
@pedrodonte
pedrodonte / gist:c20eafd6e274f5109526
Created November 5, 2015 15:07
change ports oracle xe
Stop listener in command window:
lsnrctl stop
Modify ORACLE_HOME/app/oracle/product/10.2.0/server/NETWORK/ADMIN/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
)
)
@pedrodonte
pedrodonte / Fechas_Continuas.sql
Last active August 29, 2015 14:07
Obtener fechas entre 2 fechas
--Creación de tabla con fechas de 50 años
CREATE TABLE tb_fc_fechas_continuas
(
fecha date NOT NULL,
CONSTRAINT tb_fc_fechas_continuas_pkey PRIMARY KEY (fecha)
);
--insersión de los registros 18628 dias existen en 50 años.
insert into tb_fc_fechas_continuas
select '2000-01-01'::date + d.date
public static String corrigeTargetLinks(String html){
try {
Pattern patternContenido, pTarget;
Matcher matcherContenido, mTarget;
final String PATRON_CONTENIDO_TAG_LINK = "(?i)<a([^>]+)>";
final String PATRON_ATRIBUTO_TARGET = "target=\"((_blank)|(_self)|(_parent)|(_top)+?)\"";
patternContenido = Pattern.compile(PATRON_CONTENIDO_TAG_LINK);
@pedrodonte
pedrodonte / gist:8762694
Created February 2, 2014 03:37
Analizar Time log
private static float tiempoLimpio(String cadena) {
float tiempo;
cadena = cadena.replace("real", "").replace(" ", "").replace("\t", "")
.replace("s", "").replace("m", ":");
tiempo = (60 * Float.parseFloat(cadena.split(":")[0]))
+ Float.parseFloat(cadena.split(":")[1]);
return tiempo;
}
@pedrodonte
pedrodonte / nginx
Created December 30, 2013 20:28 — forked from mustafaturan/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
#get root access
$su -
$ cd /tmp
#Remove old Ruby
$ yum remove ruby
# Install dependencies
$ yum groupinstall "Development Tools"
$ yum install zlib zlib-devel