Skip to content

Instantly share code, notes, and snippets.

View nandooliveira's full-sized avatar
🏠
Working from home

Fernando Oliveira nandooliveira

🏠
Working from home
View GitHub Profile
@nandooliveira
nandooliveira / remove-node-modules.md
Created August 7, 2023 15:30 — forked from lmcneel/remove-node-modules.md
How to remove node_modules after they have been added to a repo

How to remove node_modules

Create a .gitignore file

  1. Check for an existing .gitignore file in the project directory
ls -a
My Dotfiles
brew install fzf
brew install xclip
brew install autojump
@nandooliveira
nandooliveira / postgres_queries_and_commands.sql
Created August 5, 2020 15:47 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@nandooliveira
nandooliveira / heroku-remote.md
Created July 25, 2020 01:33 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@nandooliveira
nandooliveira / readme.md
Created November 1, 2019 16:58 — forked from maxivak/readme.md
Integrating Gem/Engine and Main Rails App
@nandooliveira
nandooliveira / Rakefile
Created August 8, 2019 05:47 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@nandooliveira
nandooliveira / 00.md
Created July 27, 2019 04:23 — forked from maxivak/00.md
Using RSpec without Rails

Using RSpec without Rails

@nandooliveira
nandooliveira / sftp-ubuntu.md
Created June 19, 2019 03:42 — forked from lymanlai/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

@nandooliveira
nandooliveira / Makefile
Created June 6, 2019 04:03 — forked from mario-chaves/Makefile
Makefile for create a simple django project
# wget --output-document=Makefile https://goo.gl/UMTpZ1
# make setup
# Colors
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
venv:
@echo "${green}>>> Creating virtualenv${reset}"