Skip to content

Instantly share code, notes, and snippets.

View jramiresbrito's full-sized avatar
🎯
Focusing

João Victor Ramires Guimarães Brito jramiresbrito

🎯
Focusing
View GitHub Profile
@arthurmde
arthurmde / postgres_queries_and_commands.sql
Last active April 9, 2024 13:41 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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%'
ORDER BY query_start desc;
-- show long-running queries (greater than 5 minutes)
SELECT
pid,
now() - pg_stat_activity.query_start AS duration,
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active June 13, 2024 12:53
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@rujmah
rujmah / rails_with_rspec_mongoid.md
Last active March 4, 2023 14:59
Quick setup for rails/rspec/mongoid spec_helper

dev bit of Gemfile

group :development, :test do
  gem "rspec-rails"
  gem 'capybara'
  gem 'factory_girl_rails'
  gem 'forgery'
  gem "database_cleaner"
  gem "mongoid-rspec"