Skip to content

Instantly share code, notes, and snippets.

View Tlaloc-Es's full-sized avatar

Joseba Fuentes Tlaloc-Es

View GitHub Profile
# coding=utf-8
#https://www.google.com/settings/security/lesssecureapps
def sendCorreo(remitente, contrasenna, destinatario, asunto, mensaje, cantidadEnvios):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
msg = "\r\n".join([
"From:" + remitente ,
"To:" + destinatario,
ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \
*2^(8-i));if(k)printf("%0o ",k);print}'
@Tlaloc-Es
Tlaloc-Es / downloadFile.js
Created June 25, 2018 11:58
Download file in node with basic auth and User-Agent.js
var https = require('https');
var fs = require('fs');
var options = {'host': 'localhost',
'path':'/path/to/file',
'auth': 'user:password',
'headers':{'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0'}
};
var file = fs.createWriteStream("file.zip");
var request = https.request(options, function (response) {
console.log('STATUS: ' + response.statusCode);
public class HierarchyEnum {
public interface Fruit {}
public static enum RedFruit implements Fruit{
RED_APPLE, TOMATOE;
}
public static enum OrangeFruit implements Fruit{
ORANGE, PAPAYA;
public class MilisecondToDate {
public final long MILISECONDS_PER_YEAR = 31536000000L;
public final long MILISECONDS_PER_DAY = 86400000L;
public final long MILISECONDS_PER_HOUR = 3600000L;
public final long MILISECONDS_PER_MINUTE = 60000L;
public final long MILISECONDS_PER_SECONDS = 1000L;
public final int FIRST_YEAR = 1970;
@Tlaloc-Es
Tlaloc-Es / pre-commit.sh
Last active April 21, 2019 11:19 — forked from chadmaughan/pre-commit.sh
A git pre commit hook that runs the test task with the gradle wrapper
#!/bin/sh
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/pre-commit.sh pre-commit
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'
@Tlaloc-Es
Tlaloc-Es / web-servers.md
Created June 13, 2019 07:50 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
function mergesort(list){
if(list.length > 1){
let middle = list.length/2
return merge(mergesort(list.slice(0, middle)), mergesort(list.slice(middle, list.length)))
}else{
return list
}
}
function merge(listA, listB){
@Tlaloc-Es
Tlaloc-Es / heapvsarray.java
Created September 20, 2019 13:39
Comparacion
package hackerrang;
import java.io.FileWriter;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Random;
public class Lista {
public static void main(String[] args) {
@Tlaloc-Es
Tlaloc-Es / mexico.geojson
Created March 23, 2020 14:02
Estados de Mexico geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.