Skip to content

Instantly share code, notes, and snippets.

View lcuevastodoit's full-sized avatar
✔️
Verified

LUIS CUEVAS lcuevastodoit

✔️
Verified
  • Bogota DC, Colombia
View GitHub Profile
@lcuevastodoit
lcuevastodoit / how_to_postgres_replica_docker.md
Created December 3, 2023 09:57
HOW TO SETUP POSTGRES DB WITH REPLICA IN DOCKER

1.- Make 1 directory for pgmaster.

sudo mkdir pgmasterdata

2.- Create a new docker container called pgmaster

docker run -dit -v "$PWD"/pgmasterdata/:/var/lib/postgresql/data -e POSTGRES_PASSWORD=abc --restart=unless-stopped --network=acme-network --name=pgmaster postgres

3.- Backup and edit pgmaster's postgresql.conf with below settings

sudo cp pgmasterdata/postgresql.conf pgmasterdata/postgresql.conf.ori
@lcuevastodoit
lcuevastodoit / create-ruby-gem-that-adds-rake-tasks.md
Created October 17, 2023 22:23 — forked from ntamvl/create-ruby-gem-that-adds-rake-tasks.md
How to create a Ruby gem that adds Rake tasks

How to create a Ruby gem that adds Rake tasks

Create a gem

One way to do this is to use bundler to scaffold our gem:

bundler gem my_gem

Add rake tasks to our gem

I prefer to put tasks meant to manage the gem itself in lib/tasks, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks.

@lcuevastodoit
lcuevastodoit / readme.md
Created June 11, 2023 19:41
how to run RSpec tests without Rails
  • Run gem install rspec to install the RSpec gem globally
  • Create an spec folder
  • Configure RSpec:
require 'rspec'

 # load root location rb classes to test
Dir['./*.rb'].sort.each { |file| require file }
 # load /app folder rb classes to test
@lcuevastodoit
lcuevastodoit / github refresh known hosts rsa host key.sh
Last active April 22, 2023 15:04
github refresh known hosts rsa host key
ssh-keygen -R github.com
sudo sh -c "> ~/.ssh/known_hosts" # only if you can delete everything
ssh-keyscan github.com >> ~/.ssh/known_hosts
git pull
@lcuevastodoit
lcuevastodoit / rails_panel.md
Last active January 31, 2023 20:54
Rails Panel

To use this extension you need to add meta_request gem to your app's Gemfile:

group :development do
  gem 'meta_request'
end
@lcuevastodoit
lcuevastodoit / repo-reset.md
Created January 21, 2023 01:55 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@lcuevastodoit
lcuevastodoit / converter.md
Last active January 20, 2023 17:32
mov-to-gif converter on mac context menu

To create a context menu action in the Mac Finder to convert a .mov video using ffmpeg via the command line, you can use the Automator app. Here are the steps: You need to install ffmpeg and gifsicle

brew install ffmpeg
brew install gifsicle
  • In the mac spotlight open Automator.app and create a new "Quick Action"
  • In the search bar, look for "Run Shell Script" and drag it to the right pane.
@lcuevastodoit
lcuevastodoit / update-rbenv-rubygems.sh
Last active December 5, 2022 16:35 — forked from gshutler/update-rbenv-rubygems.sh
Update Rubygems for all rbenv rubies
#! /usr/bin/env bash
set -e
eval "$(rbenv init -)"
for version in `rbenv whence gem`; do
rbenv shell "$version"
echo "Updating rubygems for $version"
gem update --system --no-document --quiet
@lcuevastodoit
lcuevastodoit / Ubuntu Password Protect an App.txt
Created November 13, 2022 04:57
Ubuntu Password Protect an App
# Edit the .desktop
# replace Exec=/usr/bin/myapp
# with Exec=sh -c "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/myapp"