Comple a program:
$ go build helloworld.go
$ ./helloworld
Hello, BF
Build and install program:
Images are the building blocks of the Docker world. You launch your containers
# 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" |
Use http://rubular.com/ or https://jex.im/regulex/#!flags=&re=%5E(a%7Cb)*%3F%24 to test your regex.
#####Regex Basics
# 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;
###du Summarize disk usage of each FILE, recursively for directories sorted by size
sudo du -x -h / | sort -n | tail -40
###truncate Truncate files to size 0MB
truncate -s 0 production.log
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]=user@users.com&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. |