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 / ubuntu: disable dhcp from dnsmasq-base
Created September 21, 2019 18:01 — forked from j-keck/ubuntu: disable dhcp from dnsmasq-base
how to disable dhcp server (dnsmasq-base) on ubuntu
dnsmasq from package 'dnsmasq-base' starts with a (from libvirt) generated configuration: /var/lib/libvirt/dnsmasq/default.conf.
this configuration file is not directly editable because it gets overwritten from libvirt.
there is no possibility to set 'no-dhcp-interface=eth0' per 'libvirt'.
# ###########################################################
# deactivate dhcp in dnsmasq per libvirt
# dnsmasq listen on port 53 (dns) and 67 (dhcp)
j@ubuntu:~$ sudo netstat -taupen | grep -E ':53|:67'
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 0 9817 1218/dnsmasq
@lcuevastodoit
lcuevastodoit / rails_ubuntu_18_04.txt
Last active March 2, 2021 23:18
Installing Ruby on Rails in Ubuntu 18.04 without any Ruby Manager
Installing Ruby on Rails in Ubuntu 18.04 without any Ruby Manager
1.- As Root
-- Install Ruby and other packages you could be needing for Rails
apt-get install ruby ruby-dev sqlite3 gcc g++ make zlib1g-dev
gem update system 3.0.8
gem install bundler
-- Install Node
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && \
apt-get install -y nodejs python-requests python-ipaddr && \
apt update
apt-get install -y build-essential sudo apt-utils dialog
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
sudo dpkg -i erlang-solutions_2.0_all.deb
sudo apt-get update
sudo apt-get install erlang
sudo apt-get install elixir
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get update && apt-get install -y nodejs
node -v
sudo apt-get install nginx
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 4000
sudo ufw enable
yes
systemctl status nginx
sudo nano /etc/nginx/sites-available/default
sudo nano /var/www/html/index.nginx-debian.html
sudo apt install git
ssh-keygen
cat /home/user/.ssh/id_rsa.pub
copy the content
go to the github.com/user/myapp-repository/settings
ADD DEPLOY KEY
git clone git@github.com:user/myapp-repository.git
cd myapp
git pull
Already up to date.
@lcuevastodoit
lcuevastodoit / gist:196d5b9800246b7dce8710f4916e6567
Created July 18, 2020 17:19 — forked from adilsoncarvalho/gist:1061938
How to install RSpec to your ruby gems
#
# if you are using RVM installed system wide (root)
# REMEMBER: if you are using RVM system wide NEVER run sudo gem install !!!!
#
rvmsudo gem install rspec rspec-rails rspec-rails-matchers
#
# if you are using RVM only on your local user or not using RVM at all
#
@lcuevastodoit
lcuevastodoit / docker_rescue.txt
Last active July 22, 2020 14:34
Docker Rescue Command
#Create a new folder
mkdir RescueFolder
cd RescueFolder
#Make the image backup from the container with problems.
docker commit <container-id> <backup-image-name>
#then run a new container with that image
docker run -ti --entrypoint=sh <backup-image-name>
#in other terminal session se the temporary container name that is running
docker ps
CONTAINER ID IMAGE NAMES
@lcuevastodoit
lcuevastodoit / RAILS_CHEATSHEET.md
Created August 3, 2020 21:47 — forked from crismablanco/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@lcuevastodoit
lcuevastodoit / puma.rb
Created August 7, 2020 00:14 — forked from danielalvarenga/puma.rb
Puma config for rails 5 api
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
# More: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#threads
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
@lcuevastodoit
lcuevastodoit / Rakefile
Created August 8, 2020 12:34 — forked from glava/Rakefile
Stop, Start, Restart Rake tasks for Rails
desc 'Stop rails server'
task :stop do
 File.new("tmp/pids/server.pid").tap { |f| Process.kill 9, f.read.to_i }.delete
end
desc 'Starts rails server'
task :start do
Process.exec("rails s puma -d")
end