Comple a program:
$ go build helloworld.go
$ ./helloworld
Hello, BF
Build and install program:
| require 'benchmark' | |
| require 'etc' | |
| Ractor.new { :warmup } if defined?(Ractor) | |
| def fibonacci(n) | |
| return n if (0..1).include? n | |
| fibonacci(n - 1) + fibonacci(n - 2) | |
| end | 
Images are the building blocks of the Docker world. You launch your containers
# 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;
| # 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" | 
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;
Using curl to log in setting the cookie and extracting the CSRF token:
curl http://localhost:3000/users/sign_in --cookie-jar cookie | grep csrf
curl http://localhost:3000/users/sign_in -L --data "user[email][email protected]&user[password]=my_password&authenticity_token=oy4J2HVPezOc5JrTXMyaSjeCDHhN%2Bv5yVzlvShm%2FjFc%3D" --cookie cookie
In order to have your cache always created with a group of www-data you need to do the following:
cd yourrailsapp
chgrp www-data ./tmp
sudo chmod g+s tmp
This sets the group id on your folder so that everything underneath tmp gets created with the correct permissions
References:
| Name | Aliases | Description | 
|---|---|---|
| $! | $ERROR_INFO | The exception information message set by the last 'raise' (last exception thrown). | 
| $@ | $ERROR_POSITION | Array of the backtrace of the last exception thrown. | 
| $& | $MATCH | The string matched by the last successful pattern match in this scope. | 
| $` | $PREMATCH | The string to the left of the last successful match. | 
| $' | $POSTMATCH | The string to the right of the last successful match. | 
| $+ | $LAST_PAREN_MATCH | The last group of the last successful match. | 
| $1 to $9 | The Nth group of the last successful regexp match. | |
| $~ | $LAST_MATCH_INFO | The information about the last match in the current scope. | 
| # CLOSURES IN RUBY Paul Cantrell https://innig.net | |
| # Email: username "cantrell", domain name "pobox.com" | |
| # I recommend executing this file, then reading it alongside its output. | |
| # | |
| # Alteratively, you can give yourself a sort of Ruby test by deleting all the comments, | |
| # then trying to guess the output of the code! | |
| # A closure is a block of code which meets three criteria: | |
| # |