Skip to content

Instantly share code, notes, and snippets.

@iver
iver / postgres_queries_and_commands.sql
Last active November 30, 2022 19:26 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), 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(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@iver
iver / nginx.cors.conf
Last active September 20, 2022 21:24 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "global/cors.conf"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include global/cors.conf;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@iver
iver / spacemacs-keybindings.md
Created June 11, 2022 17:23 — forked from rnwolf/spacemacs-keybindings.md
spacemacs keybindings that i need to learn
@iver
iver / mac-setup-redis.md
Created June 2, 2021 23:00 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@iver
iver / postgres-cheatsheet.md
Last active September 14, 2020 18:40 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

$ psql -U postgres

or

$ sudo -u postgres psql
@iver
iver / .drone.yml
Created June 11, 2020 21:44 — forked from wzulfikar/.drone.yml
Drone CI slack template. more on drone.io + slack integration: http://plugins.drone.io/drone-plugins/drone-slack/
pipeline:
build:
image: alpine
commands:
- echo "do something :v"
slack:
image: plugins/slack
channel: dev__builds
webhook: https://hooks.slack.com/services/...
@iver
iver / phoenix_to_umbrella
Last active November 9, 2019 22:20 — forked from emilsoman/phoenix_to_umbrella
How to move an existing phoenix app under an umbrella app
How to convert existing phoenix app to an umbrella app.
https://elixir-lang.slack.com/archives/phoenix/p1472921051000134
chrismccord [10:14 PM]
@alanpeabody yes, it's straightforward
[10:14]
1) mix new my_umbrella --umbrella
@iver
iver / Flatten solutions.md
Last active May 1, 2019 20:05
A sample of implementation

Sorry if I don't put only the code here but the instructions says:

When writing this code, you can use any language you're comfortable with. 

* The code must be well tested ...
* ... documented if necessary
* ... treat the quality of the code as if it was ready to ship to production.

So, I think the best way to do that is using a git repository.

@iver
iver / spacemacs-cheshe.md
Last active March 8, 2019 14:31 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@iver
iver / upgrade_postgres.md
Last active June 7, 2018 14:50 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)

NOTES: After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."

Database files have to be updated before starting the server, here are the steps that had to be followed:

  • Need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6