Skip to content

Instantly share code, notes, and snippets.

View LuisFcoOrtiz's full-sized avatar
:shipit:
kept you waiting, huh

Luis Manrique LuisFcoOrtiz

:shipit:
kept you waiting, huh
View GitHub Profile
@LuisFcoOrtiz
LuisFcoOrtiz / SshConnector.java
Created October 14, 2018 09:50
Clase java para conexiones mediante SSH (JSch libreria necesaria) | Java class for SSH connections (JSch neccesary library)
public class SshConector {
//variables
protected String host, user, password, consoleMessage; //variables to connect
protected Session session;
protected int port=22; //ssh port
//ssh connection
private JSch jschChannel;
private int intTimeOut = 60000; //timeout for connection
@LuisFcoOrtiz
LuisFcoOrtiz / utilComandos.sh
Last active July 8, 2024 09:01
Recopilación de comandos linux útiles (SysAdmin) || linux commands compilation for SysAdmin
LISTADO DE COMANDOS LINUX ÚTILES PARA SysAdmin
* inxi -Fxn => Muestra la información principal del equipo (https://www.comoinstalarlinux.com/inxi-un-comando-linux-para-saber-mucho-de-tu-eqiuipo/)
* eject -r => Expulsa el CD (No muy util pero sirve para trollear a otro por ssh)
* lsb_release -a => Conocer versión sistema
* df -h => muestra la capacidad de memoria de los dispositivos del sistema y su uso
* du -sh => muestra la capacidad de disco utilizada en el directorio actual
* lsblk -fm => estructura de particiones y HDD
* iptables -L => Listado de Ip tables
@LuisFcoOrtiz
LuisFcoOrtiz / getMac.cpp
Created April 16, 2018 12:57
Get Mac Address QT Cpp (function) | Obtener dirección MAC QT cpp (función))
//#include <QNetworkInterface> en cabecera
QString ClientUdp::getMacAddress() {
foreach(QNetworkInterface netInterface, QNetworkInterface::allInterfaces()) {
// Devuelve solo la primera dirección MAC que no sea de loopback
if (!(netInterface.flags() & QNetworkInterface::IsLoopBack))
return netInterface.hardwareAddress();
qDebug() << "obteniendo dirección MAC";
}
return QString();
}//funcion para obtener la direccion MAC
@LuisFcoOrtiz
LuisFcoOrtiz / ExportXML.java
Created December 18, 2017 14:50
Java class to export text to XML creating xml file | Clase Java para exportar texto a XML creando un fichero xml
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio8bdoracle;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@LuisFcoOrtiz
LuisFcoOrtiz / JTableUser.java
Created December 11, 2017 15:10
JTable component modified to get all element from ResultSet Query | Componente JTable modificado para recoger los datos de una sentencia ResultSet
import java.awt.Color;
import java.awt.Component;
import java.beans.SimpleBeanInfo;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import javax.accessibility.Accessible;
import javax.swing.JTable;
import javax.swing.Scrollable;
@LuisFcoOrtiz
LuisFcoOrtiz / ReadXML.java
Last active November 16, 2017 19:19
Method to read XML file recursively |Método recursivo lectura de fichero XML
/*METODO RECURSIVO PARA LEER XML*/
/*Method to read XML file recursively*/
private void startReader(Node nodeEntry) {
NodeList nodeList = nodeEntry.getChildNodes();
for (int i=0; i<nodeList.getLength(); i++) {
//get the item
Node node = nodeList.item(i);
if (node.getNodeType()== Node.ELEMENT_NODE) {
@LuisFcoOrtiz
LuisFcoOrtiz / ConexionBD.java
Last active June 6, 2017 09:01
java class to connect with database (SQLITE) | Clase java para conexión con base de datos (SQLITE)
import java.sql.*;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
@LuisFcoOrtiz
LuisFcoOrtiz / BackupFolder.sh
Last active July 3, 2018 18:11
(BASH)Copia de seguridad de una carpeta completa comprimiendo su tamaño | (BASH)Backup from a complete folder reducing his weight
#!/bin/bash
## make a backup from whole folder entry by argument##
## $1 only could be a folder or file ##
## For desscompress use tar -xvf file.tar.gz ##
actualDate=$(date +"%Y-%m-%d")
errorState=$?
folderPath="/home/manrique/BACKUPS"
tar -zcvf $folderPath/$1-$actualDate.tar.gz $1
##Check errors
if [ $errorState -eq 0 ]; then
@LuisFcoOrtiz
LuisFcoOrtiz / EventosRaton.java
Created February 10, 2017 15:09
Panel que registra los eventos del raton MouseListener JAVA | Panel for watch the mouse events MouseListener JAVA
/*
* EventosRaton.java
*
* Copyright 2017 manrique <https:/github.com/luisFcoOrtiz>
*
*/
import java.awt.*;
import java.awt.event.*;
@LuisFcoOrtiz
LuisFcoOrtiz / FocusExample.java
Last active February 9, 2017 11:16
Ejemplo de Focus Listener (Visualización del foco en ventana Java) | Focus Listener Example (Show in a window where is the focus)
/*
* FocusEvent.java
*
* Copyright 2017 manrique <https:/github.com/luisFcoOrtiz>
*
*
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;