Table: Post
| Column | Type | Table Modifiers |
|---|---|---|
| id | integer | not null |
| title | character varying | not null |
| description | character varying | not null |
| meta | character varying | not null |
| dbClient := datastore.Client | |
| database := dbClient.Database(datastore.DatabaseName) | |
| collection := database.Collection("users") | |
| user_count, _ := collection.FindOne( | |
| context.Background(), | |
| bson.D{}, | |
| ) | |
| fmt.Println("Number of users", user_count) |
| package db | |
| import ( | |
| "context" | |
| "fmt" | |
| "log" | |
| "os" | |
| "go.mongodb.org/mongo-driver/mongo" | |
| "go.mongodb.org/mongo-driver/mongo/options" |
Table: Post
| Column | Type | Table Modifiers |
|---|---|---|
| id | integer | not null |
| title | character varying | not null |
| description | character varying | not null |
| meta | character varying | not null |
| 0xe6fcE3877BA7C73e6Acad9F77bDCF2E14A53245c |
| #! /bin/bash | |
| # Usage: | |
| # sh add_cron.sh [key_file] [user] ip | |
| key_file=$1 | |
| username=$2 | |
| ip=$3 | |
| if [ $# -le 2 ]; then |
| - Directories | |
| - Files | |
| - Inode | |
| Each inode describes a data structure on the hard disk, storing the properties of a file. | |
| Struct | |
| - Owner, Group Owner of the file. | |
| - File type | |
| - Permissions |
| ## List all indexes | |
| ``` | |
| SELECT i.relname as indname, | |
| i.relowner as indowner, | |
| idx.indrelid::regclass, | |
| am.amname as indam, | |
| idx.indkey, | |
| ARRAY( | |
| SELECT pg_get_indexdef(idx.indexrelid, k + 1, true) |
| ## Restoring with tar from a compressed archive. | |
| ### Test the command first with 't' argument | |
| tar -ztvpf /archive/full-backup-02-March-2016.tar.gz | |
| ### Extract with 'x' argument | |
| tar -zxvpf /archive/full-backup-02-March-2016.tar.gz |
| # Money in INR(Indian Rupees) | |
| def convert(no): | |
| rev_no = no[::-1] | |
| ans = '' | |
| for index, char in enumerate(rev_no): | |
| ans = char + ans | |
| if index >= 2 and index % 2 == 0 and len(no) > index + 1: | |
| ans = ',' + ans |
| # Method 1 | |
| fn main() { | |
| for x in 1..101 { | |
| match x { | |
| x if x % 15 == 0 => println!("{} FizzBuzz", x), | |
| x if x % 5 == 0 => println!("{} Buzz", x), | |
| x if x % 3 == 0 => println!("{} Fizz", x), | |
| _ => println!("{}", x), | |
| } |