This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.Iterator; | |
import org.apache.poi.hssf.usermodel.HSSFCell; | |
import org.apache.poi.hssf.usermodel.HSSFRow; | |
import org.apache.poi.hssf.usermodel.HSSFSheet; | |
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sort | |
String input = "fksjakqbjprckekdolwhnsiajskmle"; | |
char[] charArray = input.toCharArray(); | |
Arrays.sort(charArray); | |
String sortedString = new String(charArray); | |
System.out.println(sortedString); | |
// output | |
//aabcdeefhijjjkkkkkllmnopqrsssw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
connection = MySQLdb.connect( | |
host = 'localhost', | |
user = 'root', | |
passwd = 'secret') # create the connection | |
cursor = connection.cursor() # get the cursor | |
cursor.execute("SHOW DATABASES") # execute 'SHOW TABLES' (but data is not returned) | |
tables = cursor.fetchall() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nowDateGT = function (){ | |
Date.prototype.addHours = function(h) { | |
this.setTime(this.getTime() + (h*60*60*1000)); | |
return this;} | |
now = new Date(); | |
return now.addHours(-6); | |
} | |
console.log(nowDateGT()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
used=$(free | grep Mem | awk '{print $3/$2 * 100}'); #get % of ram used | |
used=${used%.*}; #conver to int | |
used=$(($used+8)); # add 8% because is returning a wrong number | |
echo $used; | |
if [ $used -gt 95 ]; then | |
killall chrome | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# /etc/pacman.conf | |
# | |
# See the pacman.conf(5) manpage for option and repository directives | |
# | |
# GENERAL OPTIONS | |
# | |
[options] | |
# The following paths are commented out with their default values listed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Arch Linux mirrorlist generated by Cnchi # | |
Server = http://mirror.umd.edu/archlinux/$repo/os/$arch | |
Server = http://mirror.kaminski.io/archlinux/$repo/os/$arch | |
Server = http://mirrors.lug.mtu.edu/archlinux/$repo/os/$arch | |
Server = http://mirror.js-webcoding.de/pub/archlinux/$repo/os/$arch | |
Server = http://mirrors.dotsrc.org/archlinux/$repo/os/$arch | |
Server = http://mirror.math.princeton.edu/pub/archlinux/$repo/os/$arch | |
Server = http://mirrors.rit.edu/archlinux/$repo/os/$arch | |
Server = http://mirror.datacenter.by/pub/archlinux/$repo/os/$arch | |
Server = http://mirrors.n-ix.net/archlinux/$repo/os/$arch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by lexo on 4/8/17. | |
*/ | |
public class validacion { | |
public boolean isCorreo(String correo, boolean validarDominio){ | |
boolean contiene = correo.toLowerCase().contains("@"); | |
if(contiene){ | |
// si tiene arroba | |
String[] parts = correo.split("@"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package reverse.string.app; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
while (true) { /// ejecutar siempre el script | |
System.out.println("Ingrese un Nombre");// imprimir instrucciones | |
Scanner hola = new Scanner(System.in); // crear objeto scanner en hola |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int restar(number){ | |
if(number>0){ | |
number = number-1; | |
restar(number); | |
} | |
else{ | |
return number; | |
} | |
} | |
} |