Skip to content

Instantly share code, notes, and snippets.

View mayra-cabrera's full-sized avatar
💃
Nothing to do here. Go to https://gitlab.com/mayra-cabrera instead

Mayra Cabrera mayra-cabrera

💃
Nothing to do here. Go to https://gitlab.com/mayra-cabrera instead
View GitHub Profile
@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active March 24, 2022 20:30
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@mayra-cabrera
mayra-cabrera / gist:33b88ccaa383ebae1de9
Created January 27, 2015 17:56
Remove sensitive data from commits history

Imagine that you want to erase completely the file under config/secrets.yml from your commits history

Move to the working directory where the config folder is placed

cd dummy/

Run git filter-branch, forcing (--force) Git to process—but not check out (--index-filter)—the entire history of every branch and tag (--tag-name-filter cat -- --all), removing the specified file (git rm --cached --ignore-unmatch Rakefile) and any empty commits generated as a result (--prune-empty). Note that you need to specify the path to the file you want to remove, not just its filename. The previous was taken from Github documentation

git filter-branch --force --index-filter \

@mayra-cabrera
mayra-cabrera / gist:cbba64a1144436544275
Created December 11, 2014 19:24
Clear cache from production/staging server

Running something like

 bundle install --without nothing 

should clear the cache, not sure if it is recommended though. This is one seems a lot better

 rm .bundle/config

See this issue apparently it was already fix :D

@ldlsegovia
ldlsegovia / osx-postgres-postgis.sh
Last active December 6, 2022 09:54
Installing postgis 2.1.4 with previously installed postgres 9.3.2 on OS X 10.9
$ brew install geos proj gdal libxml2 json-c
$ wget http://download.osgeo.org/postgis/source/postgis-2.1.4.tar.gz
$ tar xvfz postgis-2.1.4.tar.gz
$ cd postgis-2.1.4
$ ./configure --with-projdir=path-to-proj --with-jsondir=path-to-json-c (example: ./configure --with-projdir=/opt/boxen/homebrew/Cellar/proj/4.8.0 --with-jsondir=/opt/boxen/homebrew/Cellar/json-c/0.11)
$ make
$ sudo make install
$ cd path-to-your-postgres-previously-installed/contrib/postgis-2-1 (example: cd /opt/boxen/homebrew/Cellar/postgresql/9.3.2-boxen/share/postgresql/contrib/postgis-2.1)
$ createdb template_postgis
$ createlang plpgsql template_postgis
@ushu
ushu / S3 buckets copy.md
Created October 29, 2013 16:12
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@fknappe
fknappe / 1.eloquent_ruby_basics.markdown
Created February 12, 2012 05:24
Eloquent Ruby Highlights

Chapter 1. Basics

Ruby style programming was built on two simple ideas:

  1. Code must be crystal clear
  2. Code must be concise

Example:

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@endolith
endolith / Has weird right-to-left characters.txt
Last active June 1, 2024 10:58
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶