Skip to content

Instantly share code, notes, and snippets.

@iver
iver / mac-setup-redis.md
Created Jun 2, 2021 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac
View mac-setup-redis.md

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@iver
iver / nginx.cors.conf
Last active Jul 8, 2021 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
View nginx.cors.conf
#
# 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 / .drone.yml
Created Jun 11, 2020 — forked from wzulfikar/.drone.yml
Drone CI slack template. more on drone.io + slack integration: http://plugins.drone.io/drone-plugins/drone-slack/
View .drone.yml
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 Nov 9, 2019 — forked from emilsoman/phoenix_to_umbrella
How to move an existing phoenix app under an umbrella app
View phoenix_to_umbrella
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
A sample of implementation
View Flatten solutions.md

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 Mar 8, 2019 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet
View spacemacs-cheshe.md

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 / postgres-cheatsheet.md
Last active Sep 14, 2020 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

$ psql -U postgres

or

$ sudo -u postgres psql
@iver
iver / upgrade_postgres.md
Last active Jun 7, 2018 — forked from giannisp/gist:ebaca117ac9e44231421f04e7796d5ca
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
View upgrade_postgres.md

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
@iver
iver / postgres_queries_and_commands.sql
Last active Jan 21, 2020 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- 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 / SSL-command-line.md
Last active Nov 16, 2017
Validate SSL Certificate from command line
View SSL-command-line.md

Determine SSL cert expiration date from a PEM file:

$ openssl x509 -enddate -noout -in file.pem

Check many files:

for pem in /etc/ssl/certs/*.pem; do