Skip to content

Instantly share code, notes, and snippets.

View fernandoaleman's full-sized avatar

Fernando Aleman fernandoaleman

View GitHub Profile
@fernandoaleman
fernandoaleman / redis-cannot-allocate-memory.txt
Last active March 1, 2023 14:14
redis bgsave failed because fork Cannot allocate memory
Modify /etc/sysctl.conf and add
vm.overcommit_memory=1
Then restart sysctl by:
$ sudo sysctl -p /etc/sysctl.conf
# Command to replace php memory limit in php.ini with env var
sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php5/php.ini
@fernandoaleman
fernandoaleman / INSTALL.txt
Last active April 14, 2021 09:54
Shell script to sync remote branches from upstream and push them up to forked origin
1. Copy 'git-sync-fork' script code from gist
2. Create a file called 'git-sync-fork' in any 'bin' directory in your $PATH
3. Paste script into this new file 'git-sync-fork' and save
4. Make the file executable `chmod +x git-sync-fork`
5. Run the script inside your locally forked git repo
Example:
git-sync-fork upstream origin

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@fernandoaleman
fernandoaleman / fix-libv8-mac.txt
Created May 5, 2016 15:14
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
@fernandoaleman
fernandoaleman / converting-mysql-database-contents-to-utf8
Created August 14, 2014 20:08
Converting MySQL Database Contents to UTF-8
# First create a dump of your MySQL database
mysqldump -u [user] -p database_name > database_name.sql
# Convert the data
iconv -f iso-8859-15 -t utf8 database_name.sql > database_name_iconv.sql
# Import the database
mysql -u [user] -p database_name < database_name_iconv.sql
# If you still have some specific characters that do not display
@fernandoaleman
fernandoaleman / how-to-resize-amazon-ebs-drive
Created June 27, 2014 17:32
How to resize Amazon EBS drive
# Check the name of the volume
fdisk -l
# Should look like this:
# Disk /dev/xvde: 214.7 GB, 214748364800 bytes
# Resize the volume
resize2fs /dev/xvde
@fernandoaleman
fernandoaleman / how-to-install-vsftpd-on-centos.txt
Created June 27, 2014 13:57
How To Install vsftpd on CentOS 6
Installing vsftpd on CentOS
yum install vsftpd
How to configure vsftpd:
Now that you’ve installed vsftpd, follow this procedure to configure it. These steps applies for both the linux variants.
Before you get started, stop the vsftpd by typing:
@fernandoaleman
fernandoaleman / rbenv-openssl.patch
Created June 17, 2014 15:47
Patch to solve error when installing ruby 1.8.7 or 1.9.2 with rbenv or ruby_build and openssl 1.0.1x
--- ext/openssl/ossl_pkey_ec.c
+++ ext/openssl/ossl_pkey_ec.c
@@ -757,8 +757,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSl_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
@fernandoaleman
fernandoaleman / rbenv-1.8.7-openssl.patch
Created June 5, 2014 20:41
Patch to solve error when installing ruby 1.8.7 with rbenv or ruby_build and openssl 1.0.1x
--- ext/openssl/ossl_pkey_ec.c
+++ ext/openssl/ossl_pkey_ec.c
@@ -757,8 +757,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSl_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif