Skip to content

Instantly share code, notes, and snippets.

View thnery's full-sized avatar
🎸
Playing The Blues

Tácio Nery thnery

🎸
Playing The Blues
View GitHub Profile
@thnery
thnery / .vimrc
Last active June 26, 2020 21:55
simple vim configuration
set autoindent
set backspace=indent,eol,start
set nu
filetype indent plugin on
autocmd BufWritePre * %s/\s\+$//e
set encoding=utf-8
set clipboard=unnamed
set noshowmode
set laststatus=2
set background=dark
@thnery
thnery / .zshrc
Last active June 26, 2020 21:56
basic zshrc
export ZSH="/Users/latacio.nery/.oh-my-zsh"
# ZSH_THEME="robbyrussell"
ZSH_THEME="lambda-gitster"
# ZSH_THEME="spaceship"
plugins=(git python ruby brew pip django bundler)
source $ZSH/oh-my-zsh.sh
@thnery
thnery / docker_useful_commands.sh
Created March 7, 2019 17:27
Docker useful commands
# removes all docker images
docker images -aq | awk '{print $1}' | xargs docker rmi -f
# removes all docker containers
docker ps -aq | awk '{print $1}' | xargs docker rm -f
@thnery
thnery / postgres-cheatsheet.md
Created July 22, 2018 22:53 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@thnery
thnery / Dockerfile
Last active May 27, 2018 19:43
Dockerfile with Ruby Alpine
FROM ruby:2.4.2-alpine
ADD Gemfile /app/
ADD Gemfile.lock /app/
RUN apk add --no-cache bash gawk sed grep bc coreutils vim
RUN apk add --update ruby-dev build-base git \
libxml2-dev libxslt-dev pcre-dev libffi-dev \
postgresql-dev
RUN gem install bundler --no-ri --no-rdoc && \
@thnery
thnery / sublime_config.json
Last active May 10, 2018 11:36
Sublime config file
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"color_inactive_tabs": false,
"color_scheme": "Packages/Python 3/Gloom.tmTheme",
"copy_with_empty_selection": true,
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"ignored_packages":
[
@thnery
thnery / .matplotlib
Created March 18, 2018 02:53
configuration file for matplotlib on mac osx
backend: TkAgg
@thnery
thnery / rails-jsonb-queries.rb
Last active October 5, 2018 13:59 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
"http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query"
"http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails"
# payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
# data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
AWS ECS setup
1. Create VPC
VPC Dashboard > Start VPC Wizard > VPC with a Single Public Subnet
- CIRD: 10.0.0.0/16
- VPC name: <project>-<environment>
- Public Subnet: 10.0.0.0/24
- Availiability Zone: us-east-1a
@thnery
thnery / databse_sample.yml
Created April 9, 2017 01:23
config/database for docker container
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: myapp_api_development
host: db