Skip to content

Instantly share code, notes, and snippets.

John Morales JohnMorales

  • Northern Virginia
Block or report user

Report or block JohnMorales

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JohnMorales
JohnMorales / TrueColor.md
Last active Aug 29, 2015 — forked from XVilka/TrueColour.md
True Color (16 million colors) support in various terminal applications and terminals
View TrueColor.md

Colors in terminal

It's a common confusion about terminal colors... Actually we have this:

  • plain ascii
  • ansi escape codes (16 color codes with bold/italic and background)
  • 256 color palette (216 colors + 16 gray + ansi) (colors are 24bit)
  • 24bit true color ("888" colors (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
View enable_autolink.js
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDR8YMkpSbC0EZKapJ59w1XfTs2/3sHnOPHGxeFIAneHaK1ZsbvH4DX5dbo2+OKSpukmdPAyW0iZuLpLr5tXNHuUzTQ57w8eEqlhVTx/u8l9AUWn+SazR/GDZ4Yzo+UAQrJhus6SwpHZLfjHwVqq3I3J4fdq0MzPNwFdOXI8n3KIA8stL6Z3jxlDvPjPncTNbb/evupf+0QmYH+OhlbQWAAhIHdtwRSnysDNquENn1khrl9zQyAWPhEsxUnHS3zYNVGkOw/RgGfBl07HzCzcPkR/Se0oW1heTOX2A/6qvgBAweCqfS5fHSAXaRRHnozrncgdZHAajcWYkaw3nR0VT+7 johnmorales@new-host-9.home
@JohnMorales
JohnMorales / close_docker_files.sh
Last active Aug 13, 2018
Closes leaked deleted and eventfd left by docker
View close_docker_files.sh
#!/bin/bash
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
docker_pid=$(cat /var/run/docker.pid)
gdb -p $docker_pid <<< "$( ls /proc/$docker_pid/fd -l --time-style=+'%s' | grep -E 'deleted' | awk '{ printf("p close(%s)\n", $7)}')" >/dev/null
#closing evenfds that do not have a corresponding memory.oom_control
eventfds="$(for eventfd in $(ls /proc/$docker_pid/fd -l --time-style=+'%s' | grep -E 'eventfd'| awk '{print $7}'); do
memory_pid=$((eventfd - 1))
View synology_optware.sh
mkdir /volume1/@optware
mkdir /opt
mount -o bind /volume1/@optware /opt
feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf
sed -i -e '/PATH=/ i\
@JohnMorales
JohnMorales / rbenv-install-system-wide.sh
Created Mar 30, 2017 — forked from jpfuentes2/rbenv-install-system-wide.sh
CentOS: rbenv install and system wide install
View rbenv-install-system-wide.sh
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
View gist:a04a73057f79737ae256b58236f22600
# install build dependencies
sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
# clone and install rbenv environment
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
View config_mail.sh
#!/bin/bash
#Configuring postfix to use aws ses as a gateway.
#https://gist.github.com/JohnMorales/d554e227146735217536462141fc6898
#update via `gist -u d554e227146735217536462141fc6898 config_mail.sh`
# Configuring postfix.
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
echo "Must have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set"
exit 1
fi
You can’t perform that action at this time.