Skip to content

Instantly share code, notes, and snippets.

View dariodiaz's full-sized avatar

Dario Diaz dariodiaz

View GitHub Profile
@dariodiaz
dariodiaz / highlight_sel_element.py
Created July 13, 2012 12:16 — forked from marciomazza/highlight_sel_element.py
python: Highlights a Selenium Webdriver element
import time
def highlight(element):
"""Highlights (blinks) a Selenium Webdriver element"""
driver = element._parent
def apply_style(s):
driver.execute_script("arguments[0].setAttribute('style', arguments[1]);",
element, s)
original_style = element.get_attribute('style')
apply_style("background: yellow; border: 2px solid red;")
@dariodiaz
dariodiaz / LocalStorage.java
Created March 4, 2013 03:28 — forked from roydekleijn/LocalStorage.java
Java: WebDriver and LocalStorage
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class LocalStorage {
private JavascriptExecutor js;
public LocalStorage(WebDriver webDriver) {
this.js = (JavascriptExecutor) webDriver;
}
@dariodiaz
dariodiaz / decrypt_dbeaver.py
Created June 4, 2021 18:37 — forked from felipou/decrypt_dbeaver.py
DBeaver password decryption script - for newer versions of DBeaver
# https://stackoverflow.com/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection
# requires pycryptodome lib (pip install pycryptodome)
import sys
import base64
import os
import json
from Crypto.Cipher import AES
@dariodiaz
dariodiaz / delete-remote-git.sh
Created April 14, 2021 22:23
[Delete Files from remote git repository] #git
# Remove a single file
git rm --cached password.txt
# Remove a single folder
git rm --cached -rf .idea
@dariodiaz
dariodiaz / reverse-vowels.js
Last active April 5, 2021 16:13
[Reverse vowels] Leetcode challenge - Reverse vowels #leetcode #javascript #codinginterview
var reverseVowels = function (s) {
const arr = s.split("");
let left = 0, right = arr.length;
const vowels = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];
while (left < right) {
if (vowels.indexOf(arr[left]) === -1) {
left++;
@dariodiaz
dariodiaz / reverse-string.js
Created April 5, 2021 14:51
[Reverse String] Leetcode challenge - Reverse String #leetcode #javascript #codinginterview
var reverseString = function(s) {
let left = 0; let right = s.length - 1;
while (left < right) {
let tmp = s[left];
s[left++] = s[right];
s[right--] = tmp;
}
return s;
};
@dariodiaz
dariodiaz / wordpress_notes.txt
Created February 10, 2021 21:19
[Wordpress install] with blog and contact form
# To install Wordpress on a server
https://websiteforstudents.com/setup-apache2-virtualhost-multiple-wordpress-blogs/
# To add new elements to the top menu bar
https://www.wpbeginner.com/beginners-guide/how-to-add-navigation-menu-in-wordpress-beginners-guide/
# To add a contact form
https://www.wpbeginner.com/beginners-guide/how-to-create-a-contact-form-in-wordpress/
# To setup the notifications and SMTP configuration
@dariodiaz
dariodiaz / Frontend Tools
Created November 20, 2012 15:40
javascript, html, css: List of Frontend Tools
#Landscaping With Frontend Development Tools
An opinionated list of tools for frontend (i.e. html, js, css) desktop/laptop (i.e. does not include tablet or phone yet) web development
##Coding Tools
######Workflow/Builds/Assemblers
@dariodiaz
dariodiaz / backup
Created August 29, 2012 18:34 — forked from sposmen/rsync-ssh.md
ssh: Rsync con ssh, o sea para que no pida contraseñas, es decir,con certificados
Realizar backups de manera facil con rsync y ssh
Enviado por RazaMetaL el Mié, 2007-02-14 14:27.
Tengo dos servidores, uno tiene un eggdrop que guarda el log de actividad de un canal en /home/bot/logs/canal. Hasta ahi todo esta muy bien, pero requiero que esos logs se publiquen en un sitio web que se encuentra en otro servidor.
La manera mas sencilla y practica que encontre para hacer esta tarea fue usando rsync para sincronizar los archivos de log desde un servidor a otro y que solo se copien los archivos nuevos o modificados.
Primero vamos a decidir las opciones para rsync, en mi caso y como lo explico en el parrafo anterior requiero copiar todos los archivos al nuevo servidor, despues que copie solo los nuevos archivos y/o los modificados. Todo esto lo logro pasando las opciones -avz y -e ssh a rsync.
-a para copiar recursivamente manteniendo privilegios, fecha de creacion, permisos, etc.;
@dariodiaz
dariodiaz / 0) ABC for Sendy with Laravel
Created January 21, 2014 17:17 — forked from jasonlemay/0) ABC for Sendy with Laravel
laravel: send emails with sendy
Setting up Sendy with Laravel
(there might be bugs, I striped out some parts of my code because what I have is more complicated then that, so, sorry if it's broken!)
--
I would recommand creating a database for Sendy only.
Add Sendy's database into your database.php (1)
Create the Campaign model (2), and specify that you want to use Sendy's database (Campaigns are the only thing we really need to create, other things like creating lists can be done through Sendy interface, and there is a PHP library to add subscribers)
Now, it's time to install Sendy, usually somewhere like yourapp.com/sendy or yourapp.com/newsletter