Skip to content

Instantly share code, notes, and snippets.

@albertomm
albertomm / DefaultKeyBinding.dict
Created August 29, 2023 08:43 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@albertomm
albertomm / example.sh
Created December 27, 2018 15:53
Redirect all the script output to a file
#!/bin/bash
# Log all output to a file
exec > >(tee -ia "$0.log") 2>&1
echo "This will be logged."
@albertomm
albertomm / install_docker_trusty.sh
Created December 15, 2018 19:01
Install docker-ce in Ubuntu Trusty based distribution
#/bin/bash
set -e
set -u
apt-get update
apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual \
@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
@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
#!/bin/bash
echo net.ipv6.conf.all.disable_ipv6 = 1 | sudo tee /etc/sysctl.d/99-disable-ipv6.conf
sudo sysctl --system
@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
@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 / studio.vmoptions
Created May 28, 2016 20:16
Change Android Studio's default temp folder
-Djava.io.tmpdir=/home/user/temp
@albertomm
albertomm / _aws_snippets.md
Last active May 18, 2016 17:55
AWS Snippets

AWS Snippets