Skip to content

Instantly share code, notes, and snippets.

View francisco-rojas's full-sized avatar

Francisco Rojas francisco-rojas

  • San Jose, Costa Rica
View GitHub Profile
@francisco-rojas
francisco-rojas / postgresql.md
Created May 19, 2015 17:56
PostgreSQL recipies

To create a Read only user

Access postgres console:

sudo -u postgres psql

Create user and grant read access to the database

CREATE USER user_name WITH ENCRYPTED PASSWORD 'your_password';
CREATE DATABASE user_name;
@francisco-rojas
francisco-rojas / ruby_splat.rb
Last active January 12, 2019 04:23
Ruby Splat Operator
# https://gist.github.com/francisco-rojas/db0fb04ed6aa509acc18
# https://dev.firmafon.dk/blog/drat-ruby-has-a-double-splat/
# http://blog.simplificator.com/2015/03/20/ruby-and-the-double-splat-operator/
# http://chriszetter.com/blog/2012/11/02/keyword-arguments-in-ruby-2-dot-0/
# ------------------------------------------------------Method Definition-----------------------------------------------------
puts "\n---Method Definition---\n"
def say(what, *people)
people.each { |person| puts "#{person}: #{what}" }
end
say "Hello!", "Alice", "Bob", "Carl"
@francisco-rojas
francisco-rojas / pg_read_only_user.md
Last active June 6, 2017 13:47
Postgresql read only user
# create user with password
CREATE USER read_user WITH ENCRYPTED PASSWORD 'password';

# grant access to existing tables
GRANT CONNECT ON DATABASE cpu TO read_user;
GRANT USAGE ON SCHEMA public TO read_user;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO read_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public to read_user;
@francisco-rojas
francisco-rojas / Chapter1.md
Last active February 20, 2019 18:50
The Docker Book

Chapter 1: Introduction

  • Containers instead run in user space on top of an operating system’s kernel. As a result, container virtualization is often called operating system-level virtualization.
  • Container technology allows multiple isolated user space instances to be run on a single host.
  • Containers can generally only run the same or a similar guest operating system as the underlying host.
  • Containers have also been seen as less secure than the full isolation of hypervisor virtualization. Countering this argument is that lightweight containers lack the larger attack surface of the full operating system needed by a virtual machine combined with the potential exposures of the hypervisor layer itself.
Docker Images

Images are the building blocks of the Docker world. You launch your containers

@francisco-rojas
francisco-rojas / Go Resources.md
Last active May 11, 2019 20:22
The Go Programming Language Book

Commands

Comple a program: $ go build helloworld.go

$ ./helloworld
Hello, BF

Build and install program: