Skip to content

Instantly share code, notes, and snippets.

@albertomm
albertomm / jquery_cheat_sheet.js
Last active May 3, 2016 19:45
JQuery Cheat Sheet
/* Selectors */
$("button"); // by tag name
$(".animated"); // by class name
$("#button3"); // by ID
$("someselector:nth-child(2)");
/* CSS */
$(selector).addClass("someclass");
$(selector).removeClass("someclass");
$(selector).css("color", "blue");
@albertomm
albertomm / install_patched_rsync.sh
Last active May 12, 2017 02:32
Install rsync 3.1.2 with detect-renamed patch from source
wget https://download.samba.org/pub/rsync/rsync-3.1.2.tar.gz
wget https://download.samba.org/pub/rsync/rsync-patches-3.1.2.tar.gz
tar xzvf rsync-3.1.2.tar.gz
tar xzvf rsync-patches-3.1.2.tar.gz
cd rsync-3.1.2/
patch -p1 <patches/detect-renamed.diff
@albertomm
albertomm / _bash_one_liners.md
Last active June 6, 2016 12:05
Bash one-liners

My collection of bash one-liners to be used as reference to write more complex scripts.

@albertomm
albertomm / _aws_snippets.md
Last active May 18, 2016 17:55
AWS Snippets

AWS Snippets

@albertomm
albertomm / studio.vmoptions
Created May 28, 2016 20:16
Change Android Studio's default temp folder
-Djava.io.tmpdir=/home/user/temp
@albertomm
albertomm / disable_keyboard_wakeup.sh
Last active September 25, 2018 07:02
Disable linux suspend wake up by anything but the power button
#!/bin/bash
if [ "$EUID" -ne "0" ]
then
echo "This script must be run as root."
exit 1
fi
echo EHC1 > /proc/acpi/wakeup
echo EHC2 > /proc/acpi/wakeup
@albertomm
albertomm / xfce-disable-hibernate.sh
Last active August 17, 2018 16:43
Command to hide suspend and hibernate buttons from XFCE logout dialog
#!/bin/bash
xfconf-query -c xfce4-session -p /shutdown/ShowSuspend --create --set true --type bool
xfconf-query -c xfce4-session -p /shutdown/ShowHibernate --create --set false --type bool
#!/bin/bash
echo net.ipv6.conf.all.disable_ipv6 = 1 | sudo tee /etc/sysctl.d/99-disable-ipv6.conf
sudo sysctl --system
@albertomm
albertomm / rename_to_md5.sh
Created October 21, 2018 12:03
Rename all files below certain folder to its md5sum, preserving extensions.
#!/bin/bash
find $1 -type f -print0 | \
xargs -0 md5sum | \
awk '{r = gensub( "([a-f0-9]+) (.+/)(.+)(\\..+)", "\\2\\3\\4 \\2\\1\\4", "g") ; print r ; }' | \
xargs -L1 mv -v
@albertomm
albertomm / check_ssl3.sh
Created December 15, 2018 18:57
Check for active SSLv3 protocol
#!/bin/bash
openssl s_client -connect 127.0.0.1:443 -ssl3