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
const fs = require('fs'); | |
const FILE = 'sample.txt'; | |
// Read the file for the first time and display contents | |
fs.readFile(FILE, 'utf8', (err, data) => { | |
if (err) console.log('Error:', err); | |
console.log(data); | |
// Now write 'Updated content' to the file | |
fs.writeFile(FILE, 'Updated content', err => { |
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
const fs = require('fs'); | |
const file = 'sample.txt'; | |
// Execution Starts here | |
// We just want to read some data from a file, update it, write it back and read it again. | |
// This is what it will look like with callbacks - welcome to the Callback Hell! | |
read(file, data => { | |
console.log('READ-1:', data); | |
// Now we'll change the text. |
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
kubectl run my-app — image=gcr.io/some-repo/my-app:v1 — port 3000 |
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 <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/file.h> | |
#include <unistd.h> | |
#include <string.h> | |
struct record { | |
int userid; | |
char username[6]; | |
}; |
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
# SSL configuration | |
listen 443 ssl default_server; | |
listen [::]:443 ssl default_server; | |
server_name _; | |
ssl_certificate /etc/nginx/ssl/nginx.crt; |
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
version: '2' | |
services: | |
nginx: | |
restart: always | |
build: | |
context: . | |
dockerfile: Dockerfile-nginx | |
container_name: nginx-container | |
ports: | |
- "443:443" |
NewerOlder