Skip to content

Instantly share code, notes, and snippets.

View eduardoedson's full-sized avatar

Eduardo Edson Batista Cordeiro Alves eduardoedson

View GitHub Profile
@eduardoedson
eduardoedson / js-closures-sum.js
Created April 23, 2022 23:46
JavaScript Closures Sum
function sum(a) {
return function (b) {
if(typeof(b) === 'number')
return sum(a + b)
return a
}
}
console.log(sum(5)()) // 5
console.log(sum(5)(10)()) // 15
@eduardoedson
eduardoedson / diffDate.js
Last active April 20, 2022 14:40
Difference between two dates JS
function diffDate(dateInit, dateEnd) {
const d1 = new Date(dateInit).getTime()
const d2 = new Date(dateEnd).getTime()
if (d1 === d2) {
return {
'TotalDays' : 0,
'Result' : 'The two dates are the same.'
}
} else {
A0j0RQAhIghdIoJ0igiiWUC3iGoXEdQvAIqGUeIYRMuI9ExB0wi5JqJtCvhGSY0jonOUxDpK0kEALRTVQ0A1kQhdVGgjVX1UoJEi1UkVzSTKTRV2UvFT0VAqLYXgKWkq6CqhtgJQfSUCYwHIWQCsJYLgLUHcJUh7pb+AMliUDiMWK+kxpSaL5LKwmaLPgIymymmlVgNQeA3QbJVuU7Ab6beq4SIcB6C0HOo5pOmo60psJ/CdoMZD6DyF1ouU/aK4yMJqijBZCUYLq4GYCLyD2lFYNZ9ydaLC5KaqwjvFXh0RUlquek8fF1aDkvVG13KVpAXeHIXVoGS90bVcrgIFDUxuYZVcdl84cE5wYdV8yrrTog5yWK6uz/wGl9C4XaubwyALQdzC6uYwyEIQ13/KutOiDlJU3RwGWQji+k95Lnw3jaoznbFcFZC7hP33cWF1rS9pSQ5F1pJIkWgoElkGRDXlSVEVqL61KCm1YsXK0DJMDiClyIGa8uSwiusPWCwia8kB6YBlKBJJDqU15clhuUoWfoC2HQk+qWBzNK+aT1nZeKPqTGeskoUfIRJk46orAwjAiFA1bLoNJFFY3fZTtLBqkxs0RXBhFXGaJhpcRy61rqI2uVEHKWFpsmqcpokG15EjrVQTj27eT6v5hHAestGH5ap9CYqmk3sLq4jTNNHgOshyNbVNc9vLZWNhFbXJjTpICUuTVcRpmmhwHVE18ejm/bQKp4twDqbDcrl63ya8n8JA5CrAfAL4WC5XDS8IjBZWxysQ+8D8txcUOEF5Jfh4QeAqnK5s9CE4XoH4dAkOyiCcrmz0IZgcDoBykfWwikB26iAYMHBOMEBqe4+rcLqy0YfgeAXi0yU4KINwurLRh6AIlIuqx6bbQBL5wvwUILW9x1U4XYRzMB2C4tMlOCiDcLoI52A6BOVISREoH0hWxysQ+8D8txcUEgwUfLwgcBVOFxyvQHy6BAdlEE4XlFqxBuXJobSaL6aJHi8IXM0nhPOQjT4ExadLcFAG8wnh
@eduardoedson
eduardoedson / twitterTweetUnliker.js
Created April 29, 2021 00:14 — forked from Tahax09/twitterTweetUnliker.js
Twitter auto unlike tweets - Tweet unliker
let interval = null
let count = 10000
let ntt = function(){
interval = setInterval(function(){
document.querySelectorAll('[data-testid=unlike]').forEach((t)=> {
t.click()
})
count += 1000
window.scrollTo(0, count);
@eduardoedson
eduardoedson / bashrc
Last active February 22, 2024 01:53
Configurações terminal
# *********************************************
# * ~/.bashrc Personalizado para Ubuntu *
# * System: Ubuntu 12.04 – Precise Pangolin *
# * local: /home/user/.bashrc *
# * *
# * Author: Thiago Nalli Valentim *
# * E-Mail: [email protected] *
# * Date: 2012-05-24 *
# *********************************************
# ======================================================================
@eduardoedson
eduardoedson / Config Terminal
Last active May 19, 2017 18:00
Cor do terminal e mostrar informações do git
https://github.com/mathiasbynens/dotfiles
git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh
@eduardoedson
eduardoedson / Convert_ASCII_Binary.py
Last active July 19, 2016 20:37
ASCII to Binary / Binary to ASCII
# -*- coding: utf-8 -*-
import binascii
import os
def to_binary(frase):
return bin(int(binascii.hexlify(frase), 16))
def to_ascii(frase):
return binascii.unhexlify('%x' % int(frase, 2))
# -*- coding: utf-8 -*-
import os
alfabeto = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def criptografar(normal, chave):
cifrado = ''
normal = normal.upper()
for letra in normal:
//Retorno: [1] - Se for válido | [0] - Se for inválido
int validarCPF(char *cpf)
{
int i, j, digito1 = 0, digito2 = 0;
if(strlen(cpf) != 11)
return 0;
else if((strcmp(cpf,"00000000000") == 0) || (strcmp(cpf,"11111111111") == 0) || (strcmp(cpf,"22222222222") == 0) ||
(strcmp(cpf,"33333333333") == 0) || (strcmp(cpf,"44444444444") == 0) || (strcmp(cpf,"55555555555") == 0) ||
(strcmp(cpf,"66666666666") == 0) || (strcmp(cpf,"77777777777") == 0) || (strcmp(cpf,"88888888888") == 0) ||
FILE* open_file(char *name, char *extension){
FILE* file;
file = fopen(name, extension);
if(file == NULL){
printf("\nAn error occurred while trying to open the file.\n");
}
return file;
}