$ sudo -i -u postgres
postgres@username:~$ psql
postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| /* | |
| GO program to calculate | |
| the square root of a number | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct clientData { | |
| int acctNum; // account number | |
| char lastName[ 15 ]; // account last name | |
| char firstName[ 10 ]; // account first name | |
| double balance; // account balance | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Balance inquiry | |
| // Resource: C How to Program by The Dietels | |
| #include <stdio.h> | |
| int main( void ){ | |
| int request; // request number | |
| int account; // account number | |
| char name[30]; // account name | |
| double balance; // account balance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| HOST = '127.0.0.1' | |
| PORT = 9000 | |
| inp = input('>> ') | |
| bytes_data = bytes(inp, 'utf-8') | |
| with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
| s.connect((HOST, PORT)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CC=gcc # compiler | |
| all: mainapp | |
| mainapp: main ops | |
| $(CC) main.o ops.o -o prog | |
| main: | |
| $(CC) -c main.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| typedef struct point{ | |
| int x; | |
| int y; | |
| } Point; | |
| typedef int length; | |
| int main(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(){ | |
| struct point{ | |
| int x; | |
| int y; | |
| }; | |
| struct point p1 = {10, 20}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function* infCount(){ | |
| let i = 0 | |
| while (true){ | |
| yield i | |
| i += 1 | |
| } | |
| } | |
| let inf = infCount() | |
| inf.next() // { value: 0, done: false } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def infCount(): | |
| """ | |
| Infinite counter | |
| """ | |
| i = 0 | |
| while True: | |
| yield i | |
| i += 1 | |
| # Usage |