├── test ├── test.json ├── package.json ├── index.js ├── test1 │ └── index.js └── .vscode │ └── launch.json ├── .gitignore ├── grpc-demo ├── .gitignore ├── package.json └── todo.proto ├── node-http2 ├── .gitignore ├── commands.txt ├── package.json └── index.js ├── sharding ├── .gitignore ├── shards │ ├── Dockerfile │ ├── init.sql │ └── commands.txt ├── test.js └── package.json ├── docker ├── app │ ├── node_modules │ │ ├── mime │ │ │ ├── .npmignore │ │ │ └── cli.js │ │ ├── .bin │ │ │ └── mime │ │ ├── qs │ │ │ ├── .eslintignore │ │ │ ├── test │ │ │ │ ├── index.js │ │ │ │ └── .eslintrc │ │ │ ├── lib │ │ │ │ ├── index.js │ │ │ │ └── formats.js │ │ │ ├── .editorconfig │ │ │ └── .eslintrc │ │ ├── debug │ │ │ ├── node.js │ │ │ ├── .coveralls.yml │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── .eslintrc │ │ │ ├── src │ │ │ │ ├── index.js │ │ │ │ └── inspector-log.js │ │ │ └── component.json │ │ ├── cookie-signature │ │ │ └── .npmignore │ │ ├── unpipe │ │ │ └── HISTORY.md │ │ ├── setprototypeof │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ ├── LICENSE │ │ │ └── test │ │ │ │ └── index.js │ │ ├── utils-merge │ │ │ ├── .npmignore │ │ │ └── index.js │ │ ├── mime-db │ │ │ └── index.js │ │ ├── inherits │ │ │ ├── inherits.js │ │ │ ├── inherits_browser.js │ │ │ └── LICENSE │ │ ├── express │ │ │ └── index.js │ │ ├── encodeurl │ │ │ └── HISTORY.md │ │ ├── forwarded │ │ │ └── HISTORY.md │ │ ├── depd │ │ │ └── lib │ │ │ │ └── compat │ │ │ │ └── event-listener-count.js │ │ ├── merge-descriptors │ │ │ └── HISTORY.md │ │ ├── content-type │ │ │ └── HISTORY.md │ │ ├── media-typer │ │ │ └── HISTORY.md │ │ ├── methods │ │ │ └── HISTORY.md │ │ └── toidentifier │ │ │ └── index.js │ ├── package.json │ └── index.js ├── apline │ └── dockerfile ├── tomcat │ ├── index.html │ └── dockerfile ├── httpd │ ├── dockerfile │ └── index.html ├── varnish2 │ ├── Dockerfile │ └── default.vcl ├── sharding │ ├── Dockerfile │ └── init.sql ├── shardingvideo │ ├── Dockerfile │ └── init.sql ├── varnish │ └── default.vcl ├── Dockerfile ├── node │ ├── Dockerfile │ └── app │ │ ├── index.js │ │ └── package.json ├── nhttpd │ ├── Dockerfile │ └── readme.txt └── postgres │ └── docker-compose.yml ├── microservices-example ├── .gitignore ├── commands.txt ├── Dockerfile ├── haproxy │ └── haproxy.cfg ├── app │ ├── package.json │ └── index.js └── docker-compose.yml ├── microservices-with-db ├── .env ├── app │ ├── dockerfile │ └── package.json ├── test │ ├── dockerfile │ ├── package.json │ └── index.js ├── pg11 │ └── docker-compose.yml ├── .vscode │ └── launch.json └── pg12 │ └── docker-compose.yml ├── spaceinvader └── Caddyfile ├── indexedDB └── README.md ├── site ├── site1 │ ├── Caddyfile │ └── index.html ├── index.html └── site2 │ └── index.html ├── .vscode └── settings.json ├── jsmodules └── jsmodules │ ├── README.md │ ├── error.js │ ├── test.mjs │ └── index.html ├── caddy └── Caddyfile ├── sni ├── scripts.txt ├── ali-website │ ├── mainali.png │ └── index.html ├── mark-website │ ├── mainmark.png │ └── index.html └── jennys-website │ ├── mainjenny.png │ └── index.html ├── .DS_Store ├── staticpage ├── Caddyfile1 ├── img │ ├── scott_01_01.png │ ├── scott_01_02.png │ ├── scott_01_03.png │ ├── scott_01_04.png │ ├── scott_01_05.png │ ├── scott_01_06.png │ ├── scott_01_07.png │ ├── scott_01_08.png │ ├── scott_01_09.png │ ├── scott_01_10.png │ ├── scott_02_01.png │ ├── scott_02_02.png │ ├── scott_02_03.png │ ├── scott_02_04.png │ ├── scott_02_05.png │ ├── scott_02_06.png │ ├── scott_02_07.png │ ├── scott_02_08.png │ ├── scott_02_09.png │ ├── scott_02_10.png │ ├── scott_03_01.png │ ├── scott_03_02.png │ ├── scott_03_03.png │ ├── scott_03_04.png │ ├── scott_03_05.png │ ├── scott_03_06.png │ ├── scott_03_07.png │ ├── scott_03_08.png │ ├── scott_03_09.png │ ├── scott_03_10.png │ ├── scott_04_01.png │ ├── scott_04_02.png │ ├── scott_04_03.png │ ├── scott_04_04.png │ ├── scott_04_05.png │ ├── scott_04_06.png │ ├── scott_04_07.png │ ├── scott_04_08.png │ ├── scott_04_09.png │ ├── scott_04_10.png │ ├── scott_05_01.png │ ├── scott_05_02.png │ ├── scott_05_03.png │ ├── scott_05_04.png │ ├── scott_05_05.png │ ├── scott_05_06.png │ ├── scott_05_07.png │ ├── scott_05_08.png │ ├── scott_05_09.png │ ├── scott_05_10.png │ ├── scott_06_01.png │ ├── scott_06_02.png │ ├── scott_06_03.png │ ├── scott_06_04.png │ ├── scott_06_05.png │ ├── scott_06_06.png │ ├── scott_06_07.png │ ├── scott_06_08.png │ ├── scott_06_09.png │ ├── scott_06_10.png │ ├── scott_07_01.png │ ├── scott_07_02.png │ ├── scott_07_03.png │ ├── scott_07_04.png │ ├── scott_07_05.png │ ├── scott_07_06.png │ ├── scott_07_07.png │ ├── scott_07_08.png │ ├── scott_07_09.png │ ├── scott_07_10.png │ ├── scott_08_01.png │ ├── scott_08_02.png │ ├── scott_08_03.png │ ├── scott_08_04.png │ ├── scott_08_05.png │ ├── scott_08_06.png │ ├── scott_08_07.png │ ├── scott_08_08.png │ ├── scott_08_09.png │ ├── scott_08_10.png │ ├── scott_09_01.png │ ├── scott_09_02.png │ ├── scott_09_03.png │ ├── scott_09_04.png │ ├── scott_09_05.png │ ├── scott_09_06.png │ ├── scott_09_07.png │ ├── scott_09_08.png │ ├── scott_09_09.png │ ├── scott_09_10.png │ ├── scott_10_01.png │ ├── scott_10_02.png │ ├── scott_10_03.png │ ├── scott_10_04.png │ ├── scott_10_05.png │ ├── scott_10_06.png │ ├── scott_10_07.png │ ├── scott_10_08.png │ ├── scott_10_09.png │ └── scott_10_10.png ├── test │ └── index.html └── index.html ├── touch5 ├── martha ├── package-lock.json ├── index.html ├── index.js └── package.json ├── javascript_postgres ├── .vscode │ ├── settings.json │ └── launch.json ├── package.json ├── index.js ├── fullTable.js └── asyncFullTable.js ├── postgresnode-pool ├── Caddyfile ├── Caddyfile1 ├── package.json └── .vscode │ └── launch.json ├── cookie ├── img.png ├── test.js ├── package.json └── index.html ├── beaconapi ├── img │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png ├── package.json └── index.js ├── fetchlazy └── test.png ├── mjs-github-shared-code-browser ├── .vscode │ ├── settings.json │ └── launch.json ├── package.json ├── index.mjs ├── package-lock.json └── github.mjs ├── protobuff ├── binarydata ├── employeesbinary ├── jsondata.json ├── employees.proto ├── package.json ├── package-lock.json ├── index.js └── .vscode │ └── launch.json ├── samesite ├── cookie.png └── index.html ├── samplejson ├── test.png ├── program.7z ├── test.json └── index.html ├── cookiedemo └── cookie.png ├── createrevoke └── test.png ├── lazy_loading └── img │ ├── pic1.png │ ├── pic2.png │ ├── pic3.png │ ├── pic4.png │ ├── pic5.png │ ├── pic6.png │ ├── pic7.png │ ├── pic8.png │ ├── pic9.png │ ├── pic10.png │ └── pic11.png ├── nginx-udemy-container.zip ├── nginx-udemy-container ├── html │ └── index.html ├── Dockerfile ├── app │ ├── index.js │ └── package.json └── nginx.conf ├── haproxy-runtime ├── site1 │ └── index.html ├── site2 │ └── index.html └── haproxy.cfg ├── learning-react └── my-app │ ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ └── manifest.json │ ├── .eslintcache │ └── .gitignore ├── iptables ├── iptables-redirect.txt ├── iptables-list ├── iptables-dnat- └── ptables-random-loadbalancer ├── staticpage2 ├── img │ ├── scott_01_01.png │ ├── scott_01_02.png │ ├── scott_01_03.png │ ├── scott_01_04.png │ ├── scott_01_05.png │ ├── scott_01_06.png │ ├── scott_01_07.png │ ├── scott_01_08.png │ ├── scott_01_09.png │ ├── scott_01_10.png │ ├── scott_02_01.png │ ├── scott_02_02.png │ ├── scott_02_03.png │ ├── scott_02_04.png │ ├── scott_02_05.png │ ├── scott_02_06.png │ ├── scott_02_07.png │ ├── scott_02_08.png │ ├── scott_02_09.png │ ├── scott_02_10.png │ ├── scott_03_01.png │ ├── scott_03_02.png │ ├── scott_03_03.png │ ├── scott_03_04.png │ ├── scott_03_05.png │ ├── scott_03_06.png │ ├── scott_03_07.png │ ├── scott_03_08.png │ ├── scott_03_09.png │ ├── scott_03_10.png │ ├── scott_04_01.png │ ├── scott_04_02.png │ ├── scott_04_03.png │ ├── scott_04_04.png │ ├── scott_04_05.png │ ├── scott_04_06.png │ ├── scott_04_07.png │ ├── scott_04_08.png │ ├── scott_04_09.png │ ├── scott_04_10.png │ ├── scott_05_01.png │ ├── scott_05_02.png │ ├── scott_05_03.png │ ├── scott_05_04.png │ ├── scott_05_05.png │ ├── scott_05_06.png │ ├── scott_05_07.png │ ├── scott_05_08.png │ ├── scott_05_09.png │ ├── scott_05_10.png │ ├── scott_06_01.png │ ├── scott_06_02.png │ ├── scott_06_03.png │ ├── scott_06_04.png │ ├── scott_06_05.png │ ├── scott_06_06.png │ ├── scott_06_07.png │ ├── scott_06_08.png │ ├── scott_06_09.png │ ├── scott_06_10.png │ ├── scott_07_01.png │ ├── scott_07_02.png │ ├── scott_07_03.png │ ├── scott_07_04.png │ ├── scott_07_05.png │ ├── scott_07_06.png │ ├── scott_07_07.png │ ├── scott_07_08.png │ ├── scott_07_09.png │ ├── scott_07_10.png │ ├── scott_08_01.png │ ├── scott_08_02.png │ ├── scott_08_03.png │ ├── scott_08_04.png │ ├── scott_08_05.png │ ├── scott_08_06.png │ ├── scott_08_07.png │ ├── scott_08_08.png │ ├── scott_08_09.png │ ├── scott_08_10.png │ ├── scott_09_01.png │ ├── scott_09_02.png │ ├── scott_09_03.png │ ├── scott_09_04.png │ ├── scott_09_05.png │ ├── scott_09_06.png │ ├── scott_09_07.png │ ├── scott_09_08.png │ ├── scott_09_09.png │ ├── scott_09_10.png │ ├── scott_10_01.png │ ├── scott_10_02.png │ ├── scott_10_03.png │ ├── scott_10_04.png │ ├── scott_10_05.png │ ├── scott_10_06.png │ ├── scott_10_07.png │ ├── scott_10_08.png │ ├── scott_10_09.png │ └── scott_10_10.png ├── test.json └── index.html ├── filereader ├── 317.12597594383516web.mp4 ├── 707.2398087560586nginx.png ├── 75.72694420548154nginx.png ├── package.json └── index.js ├── nginx-in-container ├── Dockerfile └── app │ ├── index.js │ └── package.json ├── ws-live-chat-system ├── Dockerfile ├── haproxy │ └── haproxy.cfg ├── how-to-run ├── app │ └── package.json └── docker-compose.yml ├── jspostgresweb ├── readme.txt ├── package.json └── .vscode │ └── launch.json ├── deno-https ├── commands.txt └── index.js ├── webrtc ├── peerA_final.js └── readme.txt ├── envoy └── commands.txt ├── estimated_count ├── package.json └── script.sql ├── zombie-cookies-demo ├── index.js └── index.html ├── tcp ├── udp.js ├── tcp.js ├── package.json └── .vscode │ └── launch.json ├── README.md ├── http-tutorial ├── index.js ├── servicea.html ├── package.json └── index.html ├── sidecar2 ├── package.json └── log.js ├── http-module ├── package.json └── .vscode │ └── launch.json ├── nginx-websockets-practice ├── package.json ├── tcp.cfg ├── useful.txt └── index.js ├── simple-uploader ├── package.json ├── .vscode │ └── launch.json └── index.js ├── isprime-blocking ├── package.json ├── test.html └── abortablefetch.js ├── isprime-non-blocking ├── package.json └── index.js ├── express-postgres └── package.json ├── nodepg ├── package.json ├── index2.js ├── insert.js └── .vscode │ └── launch.json ├── nginx-container └── nginx.conf ├── zombie-cookie ├── package.json └── normal-cookie.js ├── http-proxy ├── baloony.html ├── servicea.html ├── serviceb.html └── index.js ├── websocket-demo ├── ws.cfg ├── package.json └── .vscode │ └── launch.json ├── automate_partitions └── package.json ├── kafka ├── package.json ├── docker-compose-back.yml ├── commands.txt └── docker-compose.yml ├── sidecarlogging ├── package.json └── logging.js ├── sidecartutorial ├── package.json └── index.js ├── xss ├── package.json └── index.html ├── httpserver ├── package.json ├── package-lock.json └── index.js ├── zeromq-simplequeue ├── worker.js ├── package.json ├── server.js └── package-lock.json ├── memcached ├── package.json ├── index.js └── allcommands.txt ├── web-server-from-scratch ├── index.js └── index.html ├── express-node ├── package.json ├── index.html └── index.js ├── mongodb-js ├── package.json ├── .vscode │ └── launch.json └── package-lock.json ├── proxysimple ├── package.json ├── index.js └── package-lock.json ├── sidecar ├── package.json └── index.js ├── xmpp-demo ├── package.json ├── index.js └── hussein.js ├── mysql-javascript └── package.json ├── nginx-websockets ├── package.json ├── useful.txt ├── tcp.cfg └── ws.cfg ├── sqlinjection └── package.json ├── rabbitmq ├── package.json ├── .vscode │ └── launch.json ├── publisher.js └── scripts.md ├── rtmp ├── app2.js ├── app3.js ├── tcp.cfg ├── app1.js └── readme.txt ├── server-sent-events ├── package.json ├── sse.cfg └── index.js ├── websocket-cell-game └── package.json ├── nginx └── tcp.conf ├── idempotency ├── package.json └── index.html ├── booking-system └── package.json ├── xmlpp ├── package.json ├── index.js └── admin.js ├── lazy-vs-eager-loading ├── package.json ├── .vscode │ └── launch.json ├── lazy.mjs └── eager.mjs ├── traefik ├── tcp.yaml ├── all.yaml ├── traefik.yaml ├── wrr.yaml ├── blockadmin.yaml └── tls.yaml ├── database-leak └── readme.txt ├── jwt-course ├── package.json ├── .vscode │ └── launch.json └── create.sql ├── const └── index.html ├── authentication └── .vscode │ └── launch.json ├── package.json └── SECURITY.md /test/test.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.pem -------------------------------------------------------------------------------- /grpc-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /node-http2/.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | -------------------------------------------------------------------------------- /sharding/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/* -------------------------------------------------------------------------------- /docker/app/node_modules/mime/.npmignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker/app/node_modules/.bin/mime: -------------------------------------------------------------------------------- 1 | ../mime/cli.js -------------------------------------------------------------------------------- /microservices-example/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /docker/app/node_modules/qs/.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /microservices-with-db/.env: -------------------------------------------------------------------------------- 1 | PGHOST=husseinmac.local -------------------------------------------------------------------------------- /spaceinvader/Caddyfile: -------------------------------------------------------------------------------- 1 | husseinnasser.ddns.net 2 | -------------------------------------------------------------------------------- /indexedDB/README.md: -------------------------------------------------------------------------------- 1 | # indexedDB 2 | IndexedDB tutorial 3 | -------------------------------------------------------------------------------- /site/site1/Caddyfile: -------------------------------------------------------------------------------- 1 | localhost 2 | 3 | rewrite /api / 4 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /docker/apline/dockerfile: -------------------------------------------------------------------------------- 1 | from alpine 2 | run apk add openjdk8 3 | -------------------------------------------------------------------------------- /jsmodules/jsmodules/README.md: -------------------------------------------------------------------------------- 1 | # jsmodules 2 | es6 modules example 3 | -------------------------------------------------------------------------------- /caddy/Caddyfile: -------------------------------------------------------------------------------- 1 | myhost1.ddns.net { 2 | proxy / 127.0.0.1:8080 3 | } 4 | -------------------------------------------------------------------------------- /docker/tomcat/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | sup 4 | 5 | 6 | -------------------------------------------------------------------------------- /sni/scripts.txt: -------------------------------------------------------------------------------- 1 | generate domain 2 | generate certificate with letsencrypt 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/.DS_Store -------------------------------------------------------------------------------- /docker/app/node_modules/debug/node.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./src/node'); 2 | -------------------------------------------------------------------------------- /staticpage/Caddyfile1: -------------------------------------------------------------------------------- 1 | myhost2.ddns.net { 2 | proxy / 127.0.0.1:8080 3 | } 4 | -------------------------------------------------------------------------------- /touch5/martha: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("./index").writehtml5public(); -------------------------------------------------------------------------------- /docker/httpd/dockerfile: -------------------------------------------------------------------------------- 1 | FROM httpd 2 | COPY index.html /usr/local/apache2/htdocs 3 | -------------------------------------------------------------------------------- /docker/varnish2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM varnish:6.2 2 | 3 | COPY default.vcl /etc/varnish/ 4 | -------------------------------------------------------------------------------- /javascript_postgres/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /postgresnode-pool/Caddyfile: -------------------------------------------------------------------------------- 1 | myhost2.ddns.net { 2 | proxy / 127.0.0.1:8080 3 | } 4 | -------------------------------------------------------------------------------- /postgresnode-pool/Caddyfile1: -------------------------------------------------------------------------------- 1 | myhost2.ddns.net { 2 | proxy / 127.0.0.1 8080 3 | } 4 | -------------------------------------------------------------------------------- /sharding/shards/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres 2 | COPY init.sql /docker-entrypoint-initdb.d -------------------------------------------------------------------------------- /site/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

hello world

4 | 5 | 6 | -------------------------------------------------------------------------------- /site/site1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Site1

4 | 5 | 6 | -------------------------------------------------------------------------------- /site/site2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Site2

4 | 5 | 6 | -------------------------------------------------------------------------------- /cookie/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/cookie/img.png -------------------------------------------------------------------------------- /docker/app/node_modules/cookie-signature/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | *.sock 5 | -------------------------------------------------------------------------------- /docker/app/node_modules/debug/.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve 2 | -------------------------------------------------------------------------------- /docker/httpd/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

httpd apache

4 | 5 | 6 | -------------------------------------------------------------------------------- /docker/sharding/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres 2 | COPY init.sql /docker-entrypoint-initdb.d 3 | 4 | -------------------------------------------------------------------------------- /docker/shardingvideo/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres 2 | COPY init.sql /docker-entrypoint-initdb.d 3 | -------------------------------------------------------------------------------- /beaconapi/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/1.png -------------------------------------------------------------------------------- /beaconapi/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/2.png -------------------------------------------------------------------------------- /beaconapi/img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/3.png -------------------------------------------------------------------------------- /beaconapi/img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/4.png -------------------------------------------------------------------------------- /beaconapi/img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/5.png -------------------------------------------------------------------------------- /beaconapi/img/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/6.png -------------------------------------------------------------------------------- /beaconapi/img/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/7.png -------------------------------------------------------------------------------- /beaconapi/img/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/8.png -------------------------------------------------------------------------------- /beaconapi/img/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/beaconapi/img/9.png -------------------------------------------------------------------------------- /fetchlazy/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/fetchlazy/test.png -------------------------------------------------------------------------------- /mjs-github-shared-code-browser/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "liveServer.settings.port": 5501 3 | } -------------------------------------------------------------------------------- /protobuff/binarydata: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/protobuff/binarydata -------------------------------------------------------------------------------- /samesite/cookie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/samesite/cookie.png -------------------------------------------------------------------------------- /samplejson/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/samplejson/test.png -------------------------------------------------------------------------------- /cookiedemo/cookie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/cookiedemo/cookie.png -------------------------------------------------------------------------------- /createrevoke/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/createrevoke/test.png -------------------------------------------------------------------------------- /docker/tomcat/dockerfile: -------------------------------------------------------------------------------- 1 | from tomcat 2 | COPY index.html /usr/local/tomcat/webapps/ROOT/ 3 | EXPOSE 8080 4 | -------------------------------------------------------------------------------- /microservices-example/commands.txt: -------------------------------------------------------------------------------- 1 | docker build -t nodeapp . 2 | docker-compose up 3 | docker-compose down -------------------------------------------------------------------------------- /samplejson/program.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/samplejson/program.7z -------------------------------------------------------------------------------- /jsmodules/jsmodules/error.js: -------------------------------------------------------------------------------- 1 | gitalert("Your browser does not support javascript modules. What century is this?") -------------------------------------------------------------------------------- /lazy_loading/img/pic1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic1.png -------------------------------------------------------------------------------- /lazy_loading/img/pic2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic2.png -------------------------------------------------------------------------------- /lazy_loading/img/pic3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic3.png -------------------------------------------------------------------------------- /lazy_loading/img/pic4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic4.png -------------------------------------------------------------------------------- /lazy_loading/img/pic5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic5.png -------------------------------------------------------------------------------- /lazy_loading/img/pic6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic6.png -------------------------------------------------------------------------------- /lazy_loading/img/pic7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic7.png -------------------------------------------------------------------------------- /lazy_loading/img/pic8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic8.png -------------------------------------------------------------------------------- /lazy_loading/img/pic9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic9.png -------------------------------------------------------------------------------- /nginx-udemy-container.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/nginx-udemy-container.zip -------------------------------------------------------------------------------- /nginx-udemy-container/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | 5 | 6 | -------------------------------------------------------------------------------- /protobuff/employeesbinary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/protobuff/employeesbinary -------------------------------------------------------------------------------- /touch5/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "touch5", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /docker/app/node_modules/unpipe/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.0 / 2015-06-14 2 | ================== 3 | 4 | * Initial release 5 | -------------------------------------------------------------------------------- /haproxy-runtime/site1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

site1

4 | 5 | 6 | -------------------------------------------------------------------------------- /haproxy-runtime/site2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

site2

4 | 5 | 6 | -------------------------------------------------------------------------------- /lazy_loading/img/pic10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic10.png -------------------------------------------------------------------------------- /lazy_loading/img/pic11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/lazy_loading/img/pic11.png -------------------------------------------------------------------------------- /learning-react/my-app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /sni/ali-website/mainali.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/sni/ali-website/mainali.png -------------------------------------------------------------------------------- /docker/varnish/default.vcl: -------------------------------------------------------------------------------- 1 | vcl 4.0; 2 | 3 | backend default { 4 | .host = "husseinmac"; 5 | .port = "2015"; 6 | } 7 | -------------------------------------------------------------------------------- /docker/varnish2/default.vcl: -------------------------------------------------------------------------------- 1 | vcl 4.0; 2 | 3 | backend default { 4 | .host = "husseinmac"; 5 | .port = "2015"; 6 | } 7 | -------------------------------------------------------------------------------- /sni/mark-website/mainmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/sni/mark-website/mainmark.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_01_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_01_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_02_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_02_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_03_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_03_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_04_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_04_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_05_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_05_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_06_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_06_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_07_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_07_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_08_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_08_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_09_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_09_10.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_01.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_02.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_03.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_04.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_05.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_06.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_07.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_08.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_09.png -------------------------------------------------------------------------------- /staticpage/img/scott_10_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage/img/scott_10_10.png -------------------------------------------------------------------------------- /iptables/iptables-redirect.txt: -------------------------------------------------------------------------------- 1 | iptables --table nat --append PREROUTING --protocol tcp --dport 80 --jump REDIRECT --to 8080 2 | -------------------------------------------------------------------------------- /microservices-with-db/app/dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:13 2 | WORKDIR /home/node/app 3 | COPY . . 4 | RUN npm install 5 | CMD npm run app -------------------------------------------------------------------------------- /sni/jennys-website/mainjenny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/sni/jennys-website/mainjenny.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_01_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_01_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_02_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_02_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_03_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_03_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_04_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_04_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_05_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_05_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_06_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_06_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_07_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_07_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_08_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_08_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_09_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_09_10.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_01.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_02.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_03.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_04.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_05.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_06.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_07.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_08.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_09.png -------------------------------------------------------------------------------- /staticpage2/img/scott_10_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/staticpage2/img/scott_10_10.png -------------------------------------------------------------------------------- /cookie/test.js: -------------------------------------------------------------------------------- 1 | const app = require("express")() 2 | 3 | app.get("/", (req, res) => res.sendFile(`${__dirname}/index.html`))\ 4 | -------------------------------------------------------------------------------- /iptables/iptables-list: -------------------------------------------------------------------------------- 1 | //list nat table 2 | iptables --table nat --list 3 | 4 | //clear nat table 5 | iptables --table nat --flush -------------------------------------------------------------------------------- /microservices-with-db/test/dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:13 2 | WORKDIR /home/node/test 3 | COPY . . 4 | RUN npm install 5 | CMD npm run test -------------------------------------------------------------------------------- /filereader/317.12597594383516web.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/filereader/317.12597594383516web.mp4 -------------------------------------------------------------------------------- /filereader/707.2398087560586nginx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/filereader/707.2398087560586nginx.png -------------------------------------------------------------------------------- /filereader/75.72694420548154nginx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/filereader/75.72694420548154nginx.png -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | WORKDIR /home/node/app 3 | COPY app /home/node/app 4 | RUN npm install 5 | CMD npm run app 6 | EXPOSE 9999 -------------------------------------------------------------------------------- /learning-react/my-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/learning-react/my-app/public/favicon.ico -------------------------------------------------------------------------------- /learning-react/my-app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/learning-react/my-app/public/logo192.png -------------------------------------------------------------------------------- /learning-react/my-app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hnasr/javascript_playground/HEAD/learning-react/my-app/public/logo512.png -------------------------------------------------------------------------------- /microservices-example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | WORKDIR /home/node/app 3 | COPY app /home/node/app 4 | RUN npm install 5 | CMD npm run app -------------------------------------------------------------------------------- /nginx-in-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | WORKDIR /home/node/app 3 | COPY app /home/node/app 4 | RUN npm install 5 | CMD node index.js 6 | -------------------------------------------------------------------------------- /docker/node/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | COPY app /home/node 3 | WORKDIR /home/node/app 4 | RUN npm install 5 | CMD npm run app 6 | EXPOSE 9999 7 | -------------------------------------------------------------------------------- /nginx-udemy-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | WORKDIR /home/node/app 3 | COPY app /home/node/app 4 | RUN npm install 5 | CMD node index.js 6 | -------------------------------------------------------------------------------- /protobuff/jsondata.json: -------------------------------------------------------------------------------- 1 | [{"name":"Hussein","salary":1000,"id":1001},{"name":"Ahmed","salary":9000,"id":1002},{"name":"Rick","salary":5000,"id":1003}] -------------------------------------------------------------------------------- /sharding/shards/init.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE URL_TABLE 2 | ( 3 | ID serial NOT NULL primary key, 4 | URL text, 5 | URL_ID character(5) 6 | ) -------------------------------------------------------------------------------- /ws-live-chat-system/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:13 2 | WORKDIR /home/node/app 3 | COPY app /home/node/app 4 | RUN npm install 5 | CMD npm run app 6 | 7 | -------------------------------------------------------------------------------- /docker/app/node_modules/qs/test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./parse'); 4 | 5 | require('./stringify'); 6 | 7 | require('./utils'); 8 | -------------------------------------------------------------------------------- /docker/app/node_modules/setprototypeof/index.d.ts: -------------------------------------------------------------------------------- 1 | declare function setPrototypeOf(o: any, proto: object | null): any; 2 | export = setPrototypeOf; 3 | -------------------------------------------------------------------------------- /docker/shardingvideo/init.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE URL_TABLE 2 | ( 3 | id serial NOT NULL PRIMARY KEY, 4 | URL text, 5 | URL_ID character(5) 6 | ) 7 | -------------------------------------------------------------------------------- /jspostgresweb/readme.txt: -------------------------------------------------------------------------------- 1 | #spin up a postgres docker container 2 | docker run —name pg —publish 5432:5432 -e POSTGRES_PASSWORD=password postgres 3 | 4 | -------------------------------------------------------------------------------- /docker/app/node_modules/debug/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | example 5 | *.sock 6 | dist 7 | yarn.lock 8 | coverage 9 | bower.json 10 | -------------------------------------------------------------------------------- /deno-https/commands.txt: -------------------------------------------------------------------------------- 1 | //generate selfsign cert 2 | openssl req -x509 -newkey rsa:4096 -nodes -sha256 -subj '/CN=localhost' -keyout private.pem -out cert.pem 3 | -------------------------------------------------------------------------------- /docker/sharding/init.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE TABLE URL_TABLE 3 | ( 4 | id serial NOT NULL primary key, 5 | url text, 6 | url_id character(5) 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /docker/app/node_modules/utils-merge/.npmignore: -------------------------------------------------------------------------------- 1 | CONTRIBUTING.md 2 | Makefile 3 | docs/ 4 | examples/ 5 | reports/ 6 | test/ 7 | 8 | .jshintrc 9 | .travis.yml 10 | -------------------------------------------------------------------------------- /webrtc/peerA_final.js: -------------------------------------------------------------------------------- 1 | 2 | //this opens the connection 3 | //set answer const answer = ... 4 | localConnection.setRemoteDescription (answer).then(a=>console.log("done")) 5 | -------------------------------------------------------------------------------- /envoy/commands.txt: -------------------------------------------------------------------------------- 1 | envoytesting.ddns.net 2 | 3 | sudo certbot certonly --standalone 4 | sudo chmod 755 private.pem 5 | 6 | 7 | envoy --config-path tls2.yaml --concurrency 1 8 | -------------------------------------------------------------------------------- /estimated_count/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "estimated_count", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "express": "^4.17.1", 6 | "pg": "^8.6.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samplejson/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "movies": [ 3 | { 4 | "mid": 0, 5 | "name": "Greenbook", 6 | "rating": 9 7 | } 8 | ] 9 | 10 | } -------------------------------------------------------------------------------- /staticpage2/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "users": [ 3 | 4 | { 5 | "name": "Hussein Nasser" 6 | } , 7 | 8 | { 9 | "name" : "Ali Hussein" 10 | } 11 | 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /docker/app/node_modules/mime/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var mime = require('./mime.js'); 4 | var file = process.argv[2]; 5 | var type = mime.lookup(file); 6 | 7 | process.stdout.write(type + '\n'); 8 | 9 | -------------------------------------------------------------------------------- /docker/node/app/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")(); 2 | 3 | app.get("/", (req, res) => { 4 | res.send("Hello from a lightweight container") 5 | }) 6 | 7 | app.listen(9999, ()=>console.log("Listening on 9999")) 8 | -------------------------------------------------------------------------------- /docker/app/node_modules/mime-db/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * mime-db 3 | * Copyright(c) 2014 Jonathan Ong 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module exports. 9 | */ 10 | 11 | module.exports = require('./db.json') 12 | -------------------------------------------------------------------------------- /node-http2/commands.txt: -------------------------------------------------------------------------------- 1 | //self sign cert 2 | openssl req -x509 -newkey rsa:4096 -nodes -sha256 -subj '/CN=localhost' -keyout localhost-private.pem -out localhost-cert.pem 3 | 4 | //cert bot 5 | sudo certbot certonly --standalone 6 | -------------------------------------------------------------------------------- /zombie-cookies-demo/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")() 2 | 3 | app.get("/", (req, res) => { 4 | 5 | res.sendFile(`${__dirname}/index.html`); 6 | 7 | }) 8 | 9 | app.get("/login", (req, res)=> { 10 | 11 | }) -------------------------------------------------------------------------------- /protobuff/employees.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | message Employee { 4 | int32 id = 1; 5 | string name = 2; 6 | float salary = 3; 7 | } 8 | 9 | message Employees { 10 | repeated Employee employees = 1; 11 | } -------------------------------------------------------------------------------- /docker/app/node_modules/debug/.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | language: node_js 3 | node_js: 4 | - "6" 5 | - "5" 6 | - "4" 7 | 8 | install: 9 | - make node_modules 10 | 11 | script: 12 | - make lint 13 | - make test 14 | - make coveralls 15 | -------------------------------------------------------------------------------- /tcp/udp.js: -------------------------------------------------------------------------------- 1 | const dgram = require('dgram'); 2 | const socket = dgram.createSocket('udp4'); 3 | 4 | socket.on('message', (msg, rinfo) => { 5 | console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); 6 | }); 7 | 8 | socket.bind(8081); 9 | -------------------------------------------------------------------------------- /docker/nhttpd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM httpd 2 | RUN apt-get update 3 | RUN apt-get install -y iputils-ping 4 | RUN apt-get install -y inetutils-traceroute 5 | RUN apt-get install -y iproute2 6 | RUN apt-get install -y curl telnet dnsutils vim 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tcp/tcp.js: -------------------------------------------------------------------------------- 1 | const net = require("net") 2 | 3 | const server = net.createServer(socket => { 4 | socket.write("Hello.") 5 | socket.on("data", data => { 6 | console.log(data.toString()) 7 | }) 8 | }) 9 | 10 | server.listen(8080) 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # javascript_playground 2 | Javascript playground tutorials 3 | 4 | This is one of my biggest repos that have all the examples and codes I discuss on my YouTube Channel check it out! 5 | 6 | https://www.youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg 7 | -------------------------------------------------------------------------------- /docker/app/node_modules/inherits/inherits.js: -------------------------------------------------------------------------------- 1 | try { 2 | var util = require('util'); 3 | if (typeof util.inherits !== 'function') throw ''; 4 | module.exports = util.inherits; 5 | } catch (e) { 6 | module.exports = require('./inherits_browser.js'); 7 | } 8 | -------------------------------------------------------------------------------- /estimated_count/script.sql: -------------------------------------------------------------------------------- 1 | create table grades (id serial, g int); 2 | -- create an index to speed up count queries (I missed this on the video) 3 | create index g_idx on (g); 4 | insert into grades (g) select random()*100 from generate_series(1,10000000); 5 | 6 | -------------------------------------------------------------------------------- /sharding/test.js: -------------------------------------------------------------------------------- 1 | var HashRing = require('hashring'); 2 | 3 | var ring = new HashRing({ 4 | '127.0.0.1:11211': 200, 5 | '127.0.0.2:11211': 200, // same as above 6 | '127.0.0.3:11211': 200 7 | }); 8 | 9 | console.log(ring.get("fasdfdf")) 10 | 11 | -------------------------------------------------------------------------------- /http-tutorial/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")() 2 | const port = process.env.PORT || 3000 3 | 4 | app.get("/*", (req,res)=> { 5 | 6 | res.send(`Served by ${port}`) 7 | 8 | }) 9 | 10 | app.listen(port, ()=>console.log(`listening on ${port}`)) -------------------------------------------------------------------------------- /docker/app/node_modules/debug/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true 5 | }, 6 | "rules": { 7 | "no-console": 0, 8 | "no-empty": [1, { "allowEmptyCatch": true }] 9 | }, 10 | "extends": "eslint:recommended" 11 | } 12 | -------------------------------------------------------------------------------- /sidecar2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sidecar2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "log.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /docker/postgres/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : "3" 2 | 3 | services: 4 | pg: 5 | image: postgres 6 | pgadmin: 7 | image: dpage/pgadmin4 8 | ports: 9 | - "5555:80" 10 | environment: 11 | - PGADMIN_DEFAULT_EMAIL="hussein" 12 | - PGADMIN_DEFAULT_PASSWORD="password" 13 | -------------------------------------------------------------------------------- /postgresnode-pool/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postgresnode-pool", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start" : "node pool.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /tcp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tcp", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /beaconapi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "beacon", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /docker/app/node_modules/qs/lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var stringify = require('./stringify'); 4 | var parse = require('./parse'); 5 | var formats = require('./formats'); 6 | 7 | module.exports = { 8 | formats: formats, 9 | parse: parse, 10 | stringify: stringify 11 | }; 12 | -------------------------------------------------------------------------------- /filereader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "filereader", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /node-http2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-http2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /http-module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-module", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /nginx-websockets-practice/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nginx-websockets-practice", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC" 11 | } 12 | -------------------------------------------------------------------------------- /simple-uploader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-uploader", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /docker/app/node_modules/express/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * express 3 | * Copyright(c) 2009-2013 TJ Holowaychuk 4 | * Copyright(c) 2013 Roman Shtylman 5 | * Copyright(c) 2014-2015 Douglas Christopher Wilson 6 | * MIT Licensed 7 | */ 8 | 9 | 'use strict'; 10 | 11 | module.exports = require('./lib/express'); 12 | -------------------------------------------------------------------------------- /isprime-blocking/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "isprime-blocking", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /isprime-non-blocking/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "isprime-non-blocking", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /microservices-example/haproxy/haproxy.cfg: -------------------------------------------------------------------------------- 1 | frontend http 2 | bind *:8080 3 | mode http 4 | timeout client 10s 5 | use_backend all 6 | 7 | backend all 8 | mode http 9 | server s1 nodeapp1:1111 10 | server s2 nodeapp2:2222 11 | server s3 nodeapp3:3333 12 | server s4 nodeapp4:4444 13 | -------------------------------------------------------------------------------- /nginx-in-container/app/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | const os = require("os"); 4 | const hostname = os.hostname(); 5 | 6 | app.get("/", (req, res) => res.send("hello from " + hostname)); 7 | 8 | app.listen(8080); 9 | console.log("listening on 8080 on " + hostname) 10 | -------------------------------------------------------------------------------- /test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "pg": "^7.8.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docker/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "app": "node index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /express-postgres/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-postgres", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /nodepg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodepg", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node .", 8 | "list": "node listTable.js" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "pg": "^7.8.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /touch5/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /touch5/index.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | exports.writehtml5public = writeHTML5; 4 | 5 | function writeHTML5(){ 6 | const html5 = fs.readFileSync(`${__dirname}/index.html`) 7 | const filename = process.argv[2] 8 | fs.writeFileSync(`${process.cwd()}/${filename}`, html5) 9 | 10 | } 11 | 12 | writeHTML5(); -------------------------------------------------------------------------------- /cookie/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cookie", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.16.4" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docker/node/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "app": "node index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /isprime-blocking/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /nginx-container/nginx.conf: -------------------------------------------------------------------------------- 1 | http { 2 | 3 | upstream all { 4 | server husseinmac:2222; 5 | server husseinmac:3333; 6 | } 7 | 8 | server { 9 | listen 8080; 10 | location / { 11 | proxy_pass http://all/; 12 | } 13 | } 14 | 15 | } 16 | 17 | 18 | events { } 19 | -------------------------------------------------------------------------------- /nginx-udemy-container/app/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | const os = require("os") 4 | const hostname = os.hostname(); 5 | 6 | 7 | app.get("/", (req, res) => res.send("Hello from " + hostname ) ) ; 8 | app.listen(8080, () => console.log("listening on port 8080 on " + hostname)); 9 | 10 | -------------------------------------------------------------------------------- /zombie-cookie/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zombie-cookie", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "zombie-cookie.js", 6 | "scripts": { 7 | "zombie": "node zombie-cookie.js", 8 | "normal": "node normal-cookie.js" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC" 13 | } 14 | -------------------------------------------------------------------------------- /docker/app/node_modules/encodeurl/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.2 / 2018-01-21 2 | ================== 3 | 4 | * Fix encoding `%` as last character 5 | 6 | 1.0.1 / 2016-06-09 7 | ================== 8 | 9 | * Fix encoding unpaired surrogates at start/end of string 10 | 11 | 1.0.0 / 2016-06-08 12 | ================== 13 | 14 | * Initial release 15 | -------------------------------------------------------------------------------- /microservices-example/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "app": "node index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /docker/app/node_modules/debug/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Detect Electron renderer process, which is node, but we should 3 | * treat as a browser. 4 | */ 5 | 6 | if (typeof process !== 'undefined' && process.type === 'renderer') { 7 | module.exports = require('./browser.js'); 8 | } else { 9 | module.exports = require('./node.js'); 10 | } 11 | -------------------------------------------------------------------------------- /http-proxy/baloony.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | BALOONY stuff 11 | 12 | -------------------------------------------------------------------------------- /microservices-with-db/test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test123", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "node-fetch": "^2.6.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /touch5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "touch5", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "bin": { 7 | "touch5": "martha" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC" 15 | } 16 | -------------------------------------------------------------------------------- /websocket-demo/ws.cfg: -------------------------------------------------------------------------------- 1 | frontend ws 2 | mode http 3 | timeout client 10s 4 | bind *:80 5 | bind *:443 ssl crt /Users/HusseinNasser/haproxy/mywebsocketsite.pem 6 | default_backend wsbackend 7 | 8 | backend wsbackend 9 | mode http 10 | server s1 127.0.0.1:8080 11 | timeout connect 10s 12 | timeout server 100s 13 | 14 | -------------------------------------------------------------------------------- /automate_partitions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "automate_partitions", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.mjs", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "pg": "^8.5.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /haproxy-runtime/haproxy.cfg: -------------------------------------------------------------------------------- 1 | global 2 | stats socket ipv4@127.0.0.1:9999 level admin 3 | 4 | frontend f 5 | bind *:9000 6 | mode http 7 | timeout client 10s 8 | use_backend all 9 | 10 | 11 | backend all 12 | timeout connect 10s 13 | timeout server 60s 14 | mode http 15 | server s1 127.0.0.1:8080 16 | server s2 127.0.0.1:8081 17 | 18 | -------------------------------------------------------------------------------- /kafka/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kafka", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "kafkajs": "^1.11.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sidecarlogging/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sidecarlogging", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "logging.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.16.4" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sidecartutorial/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sidecartutorial", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "node-fetch": "^2.6.7" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /xss/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xss", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /http-tutorial/servicea.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

Service A

11 | 12 | -------------------------------------------------------------------------------- /httpserver/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpserver", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "http": "0.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jsmodules/jsmodules/test.mjs: -------------------------------------------------------------------------------- 1 | export function test() { 2 | alert("hey this is test ") 3 | } 4 | 5 | export const ar = [1,2,3,4] 6 | 7 | export class Enemy { 8 | constructor(name){ 9 | this.name = name 10 | } 11 | 12 | getName(){ 13 | return `Hey my name is ${this.name}` 14 | } 15 | } -------------------------------------------------------------------------------- /zeromq-simplequeue/worker.js: -------------------------------------------------------------------------------- 1 | const zmq = require("zeromq"); 2 | const sock = new zmq.Pull(); 3 | 4 | run(); 5 | async function run() { 6 | 7 | await sock.connect("tcp://127.0.0.1:7000"); 8 | console.log("Connected to server.") 9 | 10 | for await (const msg of sock) { 11 | console.log(`received job ${msg.toString()}`); 12 | } 13 | } -------------------------------------------------------------------------------- /http-proxy/servicea.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

THIS IS SERVICE A!!!

11 | 12 | -------------------------------------------------------------------------------- /http-proxy/serviceb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

THIS IS SERVICE B

11 | 12 | -------------------------------------------------------------------------------- /memcached/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodemem", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "memcached": "^2.2.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /web-server-from-scratch/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")() 2 | 3 | app.get("/", (req, res) => { 4 | 5 | res.sendFile(`${__dirname}/index.html`) 6 | }) 7 | 8 | app.get("/sup", (req,res) => { 9 | res.statusCode = 418; 10 | res.send("Hello!"); 11 | }) 12 | 13 | app.listen(8080, ()=>console.log("SUP I'm listening yes sir. what do you want")) -------------------------------------------------------------------------------- /ws-live-chat-system/haproxy/haproxy.cfg: -------------------------------------------------------------------------------- 1 | frontend http 2 | bind *:8080 3 | mode http 4 | timeout client 1000s 5 | use_backend all 6 | 7 | backend all 8 | mode http 9 | timeout server 1000s 10 | timeout connect 1000s 11 | server s1 ws1:8080 12 | server s2 ws2:8080 13 | server s3 ws3:8080 14 | server s4 ws4:8080 15 | -------------------------------------------------------------------------------- /express-node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-node", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /mongodb-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongodb-js", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "sslkeylog": "^0.2.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /nginx-in-container/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.18.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /proxysimple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "proxysimple", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "node-fetch": "^2.6.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sidecar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sidecar", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.16.4", 13 | "node-fetch": "^2.3.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sni/mark-website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Mark Tier Pros 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /xmpp-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xmpp-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "simple-xmpp": "^2.3.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /http-tutorial/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-tutorial", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /httpserver/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpserver", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "http": { 8 | "version": "0.0.0", 9 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.0.tgz", 10 | "integrity": "sha1-huYybSnF0Dnen6xYSkVon5KfT3I=" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /microservices-with-db/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jenkins", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "app": "node index.js" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1", 14 | "pg": "^8.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /mysql-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mysql-javascript", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "mysql2": "^2.0.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /nginx-udemy-container/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.18.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /protobuff/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "protobuff", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "google-protobuf": "^3.11.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /staticpage/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | your not suppose to see this 11 | 12 | 13 | -------------------------------------------------------------------------------- /nginx-websockets-practice/tcp.cfg: -------------------------------------------------------------------------------- 1 | stream { 2 | 3 | upstream wsbackends { 4 | 5 | server 127.0.0.1:2222; 6 | server 127.0.0.1:3333; 7 | server 127.0.0.1:4444; 8 | server 127.0.0.1:5555; 9 | } 10 | 11 | server { 12 | listen 80; 13 | proxy_pass wsbackends; 14 | } 15 | 16 | 17 | } 18 | 19 | 20 | events { } 21 | -------------------------------------------------------------------------------- /nginx-websockets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nginx-websockets", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "websocket": "^1.0.34" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sni/ali-website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Ali IPhone Repair WebSite 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /sqlinjection/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sqlinjection", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "pg": "^7.11.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ws-live-chat-system/how-to-run: -------------------------------------------------------------------------------- 1 | 1) build this image as "docker build -t wsapp ." 2 | 2) than run docker-compose up 3 | 3) open a browser console and type this 4 | 5 | let ws = new WebSocket("ws://localhost:8080"); 6 | ws.onmessage = message => console.log(`Received: ${message.data}`); 7 | ws.send("Hello! I'm client") 8 | 9 | 4) open multiple console windows to simulate multiple clients -------------------------------------------------------------------------------- /http-tutorial/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | HELLO WORLD 8 | 9 | 10 |

Hello guys! this is my first website

11 | 12 | -------------------------------------------------------------------------------- /rabbitmq/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rabbitmq", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "publisher.js", 6 | "scripts": { 7 | "publish": "node publisher.js", 8 | "consume": "node consumer.js" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "amqplib": "^0.5.5" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /rtmp/app2.js: -------------------------------------------------------------------------------- 1 | const NodeMediaServer = require('node-media-server'); 2 | 3 | const config = { 4 | rtmp: { 5 | port: 1936, 6 | chunk_size: 60000, 7 | gop_cache: true, 8 | ping: 30, 9 | ping_timeout: 60 10 | }, 11 | http: { 12 | port: 8001, 13 | allow_origin: '*' 14 | } 15 | }; 16 | 17 | var nms = new NodeMediaServer(config) 18 | nms.run(); 19 | -------------------------------------------------------------------------------- /rtmp/app3.js: -------------------------------------------------------------------------------- 1 | const NodeMediaServer = require('node-media-server'); 2 | 3 | const config = { 4 | rtmp: { 5 | port: 1937, 6 | chunk_size: 60000, 7 | gop_cache: true, 8 | ping: 30, 9 | ping_timeout: 60 10 | }, 11 | http: { 12 | port: 8002, 13 | allow_origin: '*' 14 | } 15 | }; 16 | 17 | var nms = new NodeMediaServer(config) 18 | nms.run(); 19 | -------------------------------------------------------------------------------- /server-sent-events/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server-sent-events", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sni/jennys-website/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Jenny's Strawberry Farm 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /websocket-cell-game/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websocket-cell-game", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "websocket": "^1.0.31" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /nginx/tcp.conf: -------------------------------------------------------------------------------- 1 | stream { 2 | 3 | upstream allbackend { 4 | server 127.0.0.1:2222; 5 | server 127.0.0.1:3333; 6 | server 127.0.0.1:4444; 7 | server 127.0.0.1:5555; 8 | } 9 | 10 | 11 | 12 | server { 13 | listen 80; 14 | proxy_pass allbackend; 15 | 16 | } 17 | 18 | 19 | 20 | } 21 | 22 | events { } 23 | -------------------------------------------------------------------------------- /zombie-cookie/normal-cookie.js: -------------------------------------------------------------------------------- 1 | const app = require("express")() 2 | 3 | app.get("/", (req,res)=>{ 4 | res.sendFile(`${__dirname}/index.html`) 5 | }) 6 | 7 | app.get("/login", (req,res) =>{ 8 | const user = req.query.user; 9 | res.setHeader("set-cookie", [`user=${user}`]) 10 | res.send("set"); 11 | }) 12 | 13 | app.listen(8081, ()=>console.log("listening to 8081")) -------------------------------------------------------------------------------- /idempotency/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "idempotency", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1", 14 | "pg": ">=7.0.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nginx-websockets/useful.txt: -------------------------------------------------------------------------------- 1 | #kill all node processes 2 | sudo killall node 3 | #stop nginx 4 | nginx -s stop 5 | #kill any dead nginx processes 6 | sudo killall nginx 7 | #run node 8 | node index.js 2222 & node index.js 3333 & node index.js 4444 & node index.js 5555 9 | #run nginx with a config 10 | nginx -c /Users/HusseinNasser/javascript/javascript_playground/nginx-websockets/tcp.cfg -------------------------------------------------------------------------------- /booking-system/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "booking-system", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1", 14 | "pg": "^8.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nginx-websockets/tcp.cfg: -------------------------------------------------------------------------------- 1 | stream { 2 | 3 | upstream allbackend { 4 | server 127.0.0.1:2222; 5 | server 127.0.0.1:3333; 6 | server 127.0.0.1:4444; 7 | server 127.0.0.1:5555; 8 | } 9 | 10 | 11 | 12 | server { 13 | listen 8080; 14 | proxy_pass allbackend; 15 | 16 | } 17 | 18 | 19 | 20 | } 21 | 22 | events { } 23 | -------------------------------------------------------------------------------- /web-server-from-scratch/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

HEY I WROTE ALL OF THIS MYSELF! NODEJS BABES

11 | 12 | -------------------------------------------------------------------------------- /websocket-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websocket-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "websocket": "^1.0.29", 14 | "ws": "^8.2.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /grpc-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grpc-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@grpc/proto-loader": "^0.5.3", 14 | "grpc": "^1.24.9" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /nginx-websockets-practice/useful.txt: -------------------------------------------------------------------------------- 1 | #kill all node processes 2 | sudo killall node 3 | #stop nginx 4 | nginx -s stop 5 | #kill any dead nginx processes 6 | sudo killall nginx 7 | #run node 8 | node index.js 2222 & node index.js 3333 & node index.js 4444 & node index.js 5555 9 | #run nginx with a config 10 | nginx -c /Users/HusseinNasser/javascript/javascript_playground/nginx-websockets/tcp.cfg -------------------------------------------------------------------------------- /rtmp/tcp.cfg: -------------------------------------------------------------------------------- 1 | frontend rtmp_frontend 2 | mode tcp 3 | timeout client 50000 4 | bind *:4321 5 | default_backend rtmp_backend 6 | 7 | 8 | backend rtmp_backend 9 | mode tcp 10 | timeout connect 60 11 | timeout server 50000 12 | server server1 127.0.0.1:1935 check 13 | server server2 127.0.0.1:1936 check 14 | server server3 127.0.0.1:1937 check 15 | -------------------------------------------------------------------------------- /learning-react/my-app/.eslintcache: -------------------------------------------------------------------------------- 1 | [{"/Users/HusseinNasser/javascript/javascript_playground/learning-react/my-app/src/index.js":"1"},{"size":2020,"mtime":1610912816749,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"12uy5rd","/Users/HusseinNasser/javascript/javascript_playground/learning-react/my-app/src/index.js",[]] -------------------------------------------------------------------------------- /mjs-github-shared-code-browser/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mjs-github-shared-code-browser", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "node-fetch": "^2.6.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ws-live-chat-system/app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.mjs", 6 | "scripts": { 7 | "app": "node index.mjs" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "http": "0.0.1-security", 14 | "redis": "^3.0.2", 15 | "websocket": "^1.0.31" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /xmlpp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xmlpp", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@xmpp/client": "^0.12.0", 13 | "@xmpp/debug": "^0.12.0", 14 | "simple-xmpp": "^2.3.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jspostgresweb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jspostgresweb", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.0", 14 | "pg": "^7.11.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /idempotency/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Place order 7 | 8 | 9 |

Place Order

10 | 11 |
12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /lazy-vs-eager-loading/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lazy-vs-eager-loading", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "eager.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1", 14 | "node-fetch": "^2.6.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /docker/app/node_modules/forwarded/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.1.2 / 2017-09-14 2 | ================== 3 | 4 | * perf: improve header parsing 5 | * perf: reduce overhead when no `X-Forwarded-For` header 6 | 7 | 0.1.1 / 2017-09-10 8 | ================== 9 | 10 | * Fix trimming leading / trailing OWS 11 | * perf: hoist regular expression 12 | 13 | 0.1.0 / 2014-09-21 14 | ================== 15 | 16 | * Initial release 17 | -------------------------------------------------------------------------------- /isprime-blocking/abortablefetch.js: -------------------------------------------------------------------------------- 1 | function isPrime(number, timeout=2000){ 2 | const controller = new AbortController(); 3 | 4 | setTimeout(()=> controller.abort(), timeout) 5 | fetch(`http://localhost:8081/isprime?number=${number}`, 6 | {"signal": controller.signal}) 7 | .then(r=>r.json()) 8 | .then(console.log) 9 | .catch(e=>console.log(e.message)) 10 | ​ 11 | } 12 | -------------------------------------------------------------------------------- /zeromq-simplequeue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zeromq-simplequeue", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "zeromq": "^6.0.0-beta.6" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /http-proxy/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")() 2 | 3 | app.get("/", (req, res)=> { 4 | 5 | if (req.host === "google.com") 6 | res.status(301).redirect("https://hnasr.github.io/") 7 | 8 | 9 | /* 10 | res.sendStatus(301) 11 | console.log(req); 12 | res.sendFile(`${__dirname}/${req.host}.html`) 13 | */ 14 | }) 15 | 16 | 17 | app.listen(8080, ()=>console.log("Proxy is listening on 8080")) -------------------------------------------------------------------------------- /server-sent-events/sse.cfg: -------------------------------------------------------------------------------- 1 | #sse haproxy configuratio 2 | 3 | frontend sse 4 | bind *:8080 5 | timeout client 3s 6 | mode http 7 | use_backend allsse 8 | 9 | backend allsse 10 | mode http 11 | timeout connect 2s 12 | timeout server 6000s 13 | server server1 localhost:1111 14 | server server2 localhost:2222 15 | server server3 localhost:3333 16 | 17 | -------------------------------------------------------------------------------- /sharding/shards/commands.txt: -------------------------------------------------------------------------------- 1 | //buidling the image 2 | docker build -t pgshard . 3 | 4 | //spin up the containers 5 | docker run --name shard1 -p 5432:5432 pgshard 6 | docker run --name shard2 -p 5433:5432 pgshard 7 | docker run --name shard3 -p 5434:5432 pgshard 8 | 9 | //spin up pgadmin 10 | docker run -e PGADMIN_DEFAULT_EMAIL=“hussein” -e PGADMIN_DEFAULT_PASSWORD="password" -p 5555:80 —name pgadmin dpage/pgadmin4 11 | 12 | -------------------------------------------------------------------------------- /mjs-github-shared-code-browser/index.mjs: -------------------------------------------------------------------------------- 1 | import { GitHub } from "./github.mjs"; 2 | 3 | async function run (){ 4 | 5 | try { 6 | const github = new GitHub(); 7 | const res = await github.emojis(); 8 | const j = await res.json(); 9 | Object.keys(j).forEach(k => console.log (`${k} : ${j[k]}`)) 10 | } 11 | catch(e) 12 | { 13 | console.error(e) 14 | } 15 | } 16 | 17 | run(); -------------------------------------------------------------------------------- /docker/nhttpd/readme.txt: -------------------------------------------------------------------------------- 1 | docker build . -t nhttpd 2 | docker create network backend --subnet 10.0.0.0/24 3 | docker create network frontend --subnet 10.0.1.0/24 4 | 5 | docker run --name s1 --network backend --cap-add=NET_ADMIN -d nhttpd 6 | docker run --name s2 --network frontend --cap-add=NET_ADMIN -d nhttpd 7 | //add it on s2 8 | ip route add 10.0.0.0/24 via 10.0.1.3 9 | //add it on s1 10 | ip route add 10.0.1.0/24 via 10.0.0.3 11 | -------------------------------------------------------------------------------- /nginx-udemy-container/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | http { 3 | 4 | upstream nodebackend { 5 | 6 | server nodeapp1:8080; 7 | server nodeapp2:8080; 8 | server nodeapp3:8080; 9 | 10 | } 11 | 12 | 13 | server { 14 | listen 8080; 15 | location / { 16 | 17 | proxy_pass http://nodebackend/; 18 | } 19 | 20 | 21 | } 22 | 23 | } 24 | 25 | events 26 | { 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /express-node/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ping test 7 | 8 | 9 | 10 | 11 | 12 | Click This Link 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /learning-react/my-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /proxysimple/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")(); 2 | const fetch = require("node-fetch") 3 | 4 | app.get("/*", (req, res) => { 5 | fetch(req.url).then(a=>a.text()).then(a=>{ 6 | a = "

My proxy saw this, I know what you are up to.

" + a; 7 | res.send(a) 8 | }); 9 | console.log("hey someone made request") 10 | 11 | }) 12 | 13 | app.listen(8080, ()=> 14 | console.log("Listening on port 8080")) 15 | -------------------------------------------------------------------------------- /docker/app/node_modules/debug/component.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debug", 3 | "repo": "visionmedia/debug", 4 | "description": "small debugging utility", 5 | "version": "2.6.9", 6 | "keywords": [ 7 | "debug", 8 | "log", 9 | "debugger" 10 | ], 11 | "main": "src/browser.js", 12 | "scripts": [ 13 | "src/browser.js", 14 | "src/debug.js" 15 | ], 16 | "dependencies": { 17 | "rauchg/ms.js": "0.7.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /javascript_postgres/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "javascript_postgres", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node index.js", 8 | "fulltable": "node fullTable.js", 9 | "asyncfulltable": "node asyncFullTable.js" 10 | }, 11 | "author": "Hussein", 12 | "license": "ISC", 13 | "dependencies": { 14 | "pg": "^7.8.0", 15 | "pg-cursor": "^2.0.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /proxysimple/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "proxysimple", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "node-fetch": { 8 | "version": "2.6.0", 9 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", 10 | "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nodepg/index2.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | 3 | const client = new Client({ 4 | user : "postgres", 5 | password : "postgres", 6 | host : "husseinmac", 7 | port : 5432, 8 | database : "husseindb" 9 | }) 10 | 11 | 12 | client.connect() 13 | .then(console.log("Connected successfully")) 14 | .then(() => client.query ("select * from employees")) 15 | .then(result => console.table(result.rows)) 16 | .catch(console.error) 17 | .finally() -------------------------------------------------------------------------------- /nodepg/insert.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | 3 | const client = new Client({ 4 | user: "postgres", 5 | password: "postgres", 6 | host: "husseinmac", 7 | port: 5432, 8 | database: "husseindb" 9 | }) 10 | 11 | client.connect() 12 | .then(() => console.log("Connected.")) 13 | .then(() => client.query("select * from employees")) 14 | .then(results => console.table(results.rows)) 15 | .catch(console.error) 16 | .finally(()=> client.end()) -------------------------------------------------------------------------------- /protobuff/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "protobuff", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "google-protobuf": { 8 | "version": "3.11.3", 9 | "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.11.3.tgz", 10 | "integrity": "sha512-Sp8E+0AJLxmiPwAk9VH3MkYAmYYheNUhywIyXOS7wvRkqbIYcHtGzJzIYicNqYsqgKmY35F9hxRkI+ZTqTB4Tg==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /traefik/tcp.yaml: -------------------------------------------------------------------------------- 1 | tcp: 2 | routers: 3 | allbackendrouter: 4 | rule: "HostSNI(`*`)" 5 | service: allbackend 6 | 7 | services: 8 | allbackend: 9 | loadBalancer: 10 | servers: 11 | - address: "husseinmac:1111" 12 | - address: "husseinmac:2222" 13 | - address: "husseinmac:3333" 14 | - address: "husseinmac:4444" -------------------------------------------------------------------------------- /grpc-demo/todo.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package todoPackage; 4 | 5 | service Todo { 6 | rpc createTodo(TodoItem) returns (TodoItem); 7 | rpc readTodos(voidNoParam) returns (TodoItems); 8 | rpc readTodosStream(voidNoParam) returns (stream TodoItem); 9 | 10 | } 11 | 12 | message voidNoParam {} 13 | 14 | message TodoItem { 15 | int32 id = 1; 16 | string text = 2; 17 | } 18 | 19 | message TodoItems { 20 | repeated TodoItem items = 1; 21 | } -------------------------------------------------------------------------------- /sharding/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sharding", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "consistent-hash": "^1.0.2", 14 | "crypto": "^1.0.1", 15 | "express": "^4.17.1", 16 | "hashring": "^3.2.0", 17 | "pg": "^7.14.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sidecarlogging/logging.js: -------------------------------------------------------------------------------- 1 | //my logging sidecar process 2 | const express = require("express") 3 | const app = express() 4 | app.use(express.json()) 5 | /* 6 | { 7 | num: 110 8 | } 9 | */ 10 | app.post("/", (req, res) => { 11 | const num = req.body.num 12 | const message = `Hey your number squared is ${num*num}` 13 | console.log(message) 14 | res.send(JSON.stringify({success:true})) 15 | }) 16 | 17 | app.listen(8080, () => console.log("Listening on port 8080")) -------------------------------------------------------------------------------- /traefik/all.yaml: -------------------------------------------------------------------------------- 1 | http: 2 | routers: 3 | allbackendrouter: 4 | rule: "Host(`husseinmac`)" 5 | service: allbackend 6 | services: 7 | allbackend: 8 | loadBalancer: 9 | servers: 10 | - url: "http://husseinmac:1111/" 11 | - url: "http://husseinmac:2222/" 12 | - url: "http://husseinmac:3333/" 13 | - url: "http://husseinmac:4444/" -------------------------------------------------------------------------------- /database-leak/readme.txt: -------------------------------------------------------------------------------- 1 | postgres=# create table todos(id serial, todo text); 2 | CREATE TABLE 3 | docker run --name pg --publish 5432:5432 -e POSTGRES_PASSWORD=password postgres 4 | docker exec -it pg psql -U postgres 5 | 6 | postgres=# insert into todos (todo) values ('clean room'); 7 | INSERT 0 1 8 | postgres=# insert into todos (todo) values ('clean fridge'); 9 | INSERT 0 1 10 | postgres=# insert into todos (todo) values ('clean everything'); 11 | INSERT 0 1 12 | postgres=# 13 | -------------------------------------------------------------------------------- /docker/app/node_modules/debug/src/inspector-log.js: -------------------------------------------------------------------------------- 1 | module.exports = inspectorLog; 2 | 3 | // black hole 4 | const nullStream = new (require('stream').Writable)(); 5 | nullStream._write = () => {}; 6 | 7 | /** 8 | * Outputs a `console.log()` to the Node.js Inspector console *only*. 9 | */ 10 | function inspectorLog() { 11 | const stdout = console._stdout; 12 | console._stdout = nullStream; 13 | console.log.apply(console, arguments); 14 | console._stdout = stdout; 15 | } 16 | -------------------------------------------------------------------------------- /mjs-github-shared-code-browser/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mjs-github-shared-code-browser", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "node-fetch": { 8 | "version": "2.6.0", 9 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", 10 | "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /protobuff/index.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | const employees = [] 4 | 5 | employees.push({ 6 | "name": "Hussein", 7 | "salary": 1000, 8 | "id": 1001 9 | }) 10 | 11 | const ahmed = { 12 | "name": "Ahmed", 13 | "salary": 9000, 14 | "id": 1002 15 | } 16 | 17 | employees.push(ahmed); 18 | 19 | employees.push({ 20 | "name": "Rick", 21 | "salary": 5000, 22 | "id": 1003 23 | }) 24 | 25 | fs.writeFileSync("jsondata.json", JSON.stringify(employees)); -------------------------------------------------------------------------------- /beaconapi/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | 4 | app.get("/", (req, res) => res.sendFile(`${__dirname}/index.html`)) 5 | app.get("/img/:id", (req, res)=> { 6 | const id = req.params.id; 7 | res.sendFile(`${__dirname}/img/${id}`) 8 | }) 9 | 10 | app.post("/", (req, res) => { 11 | console.log(`id ${req.query.id} timespent ${req.query.timespent} ms`) 12 | res.sendStatus(204); 13 | }) 14 | app.listen(8080, ()=>console.log("Listening on 8080")) -------------------------------------------------------------------------------- /docker/app/node_modules/depd/lib/compat/event-listener-count.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * depd 3 | * Copyright(c) 2015 Douglas Christopher Wilson 4 | * MIT Licensed 5 | */ 6 | 7 | 'use strict' 8 | 9 | /** 10 | * Module exports. 11 | * @public 12 | */ 13 | 14 | module.exports = eventListenerCount 15 | 16 | /** 17 | * Get the count of listeners on an event emitter of a specific type. 18 | */ 19 | 20 | function eventListenerCount (emitter, type) { 21 | return emitter.listeners(type).length 22 | } 23 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | const client = new Client({ 3 | user: "postgres", 4 | password: "postgres", 5 | host: "husseinmac", 6 | port: 5432, 7 | database: "husseindb" 8 | }) 9 | 10 | client.connect() 11 | .then(() => console.log("Connected successfuly")) 12 | .then(() => client.query("select * from employees where name = $1", ["Edmond"])) 13 | .then(results => console.table(results.rows)) 14 | .catch(e => console.log(e)) 15 | .finally(() => client.end()) -------------------------------------------------------------------------------- /docker/app/node_modules/setprototypeof/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | /* eslint no-proto: 0 */ 3 | module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties) 4 | 5 | function setProtoOf (obj, proto) { 6 | obj.__proto__ = proto 7 | return obj 8 | } 9 | 10 | function mixinProperties (obj, proto) { 11 | for (var prop in proto) { 12 | if (!obj.hasOwnProperty(prop)) { 13 | obj[prop] = proto[prop] 14 | } 15 | } 16 | return obj 17 | } 18 | -------------------------------------------------------------------------------- /tcp/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/udp.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /test/test1/index.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | const client = new Client({ 3 | user: "postgres", 4 | password: "postgres", 5 | host: "husseinmac", 6 | port: 5432, 7 | database: "husseindb" 8 | }) 9 | 10 | client.connect() 11 | .then(() => console.log("Connected successfuly")) 12 | .then(() => client.query("select * from employees where name = $1", ["Edmond"])) 13 | .then(results => console.table(results.rows)) 14 | .catch(e => console.log(e)) 15 | .finally(() => client.end()) -------------------------------------------------------------------------------- /docker/app/node_modules/merge-descriptors/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.1 / 2016-01-17 2 | ================== 3 | 4 | * perf: enable strict mode 5 | 6 | 1.0.0 / 2015-03-01 7 | ================== 8 | 9 | * Add option to only add new descriptors 10 | * Add simple argument validation 11 | * Add jsdoc to source file 12 | 13 | 0.0.2 / 2013-12-14 14 | ================== 15 | 16 | * Move repository to `component` organization 17 | 18 | 0.0.1 / 2013-10-29 19 | ================== 20 | 21 | * Initial release 22 | -------------------------------------------------------------------------------- /docker/app/node_modules/qs/lib/formats.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var replace = String.prototype.replace; 4 | var percentTwenties = /%20/g; 5 | 6 | module.exports = { 7 | 'default': 'RFC3986', 8 | formatters: { 9 | RFC1738: function (value) { 10 | return replace.call(value, percentTwenties, '+'); 11 | }, 12 | RFC3986: function (value) { 13 | return value; 14 | } 15 | }, 16 | RFC1738: 'RFC1738', 17 | RFC3986: 'RFC3986' 18 | }; 19 | -------------------------------------------------------------------------------- /nodepg/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/insert.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /test/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/index.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /javascript_postgres/index.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | const client = new Client({ 3 | user: "postgres", 4 | password: "postgres", 5 | host: "husseinmac", 6 | port: 5432, 7 | database: "husseindb" 8 | }) 9 | 10 | client.connect() 11 | .then(() => console.log("Connected successfuly")) 12 | .then(() => client.query("select * from employees where name = $1", ["Edmond"])) 13 | .then(results => console.table(results.rows)) 14 | .catch(e => console.log(e)) 15 | .finally(() => client.end()) -------------------------------------------------------------------------------- /jwt-course/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jwt-course", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "bcrypt": "^4.0.1", 14 | "cookie-parser": "^1.4.5", 15 | "crypto": "^1.0.1", 16 | "express": "^4.17.1", 17 | "jsonwebtoken": "^8.5.1", 18 | "pg": "^8.0.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /rabbitmq/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/consumer.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /javascript_postgres/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/tx.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /memcached/index.js: -------------------------------------------------------------------------------- 1 | const MEMCACHED = require("memcached"); 2 | const serverPool = new MEMCACHED(["husseinmac:11211", "husseinmac:11212", "husseinmac:11213", "husseinmac:11214"]); 3 | 4 | function run () { 5 | [1,2,3,4,5,6,7,8,9].forEach(a=> serverPool.set("foo"+ a, "bar"+a, 3600, err => console.log(err))); 6 | 7 | } 8 | 9 | //run(); 10 | 11 | function read(){ 12 | 13 | [1,2,3,4,5,6,7,8,9].forEach(a=> serverPool.get("foo"+ a, (err, data) => console.log(data))); 14 | } 15 | 16 | read(); 17 | 18 | 19 | -------------------------------------------------------------------------------- /postgresnode-pool/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}/all.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /docker/app/node_modules/utils-merge/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Merge object b with object a. 3 | * 4 | * var a = { foo: 'bar' } 5 | * , b = { bar: 'baz' }; 6 | * 7 | * merge(a, b); 8 | * // => { foo: 'bar', bar: 'baz' } 9 | * 10 | * @param {Object} a 11 | * @param {Object} b 12 | * @return {Object} 13 | * @api public 14 | */ 15 | 16 | exports = module.exports = function(a, b){ 17 | if (a && b) { 18 | for (var key in b) { 19 | a[key] = b[key]; 20 | } 21 | } 22 | return a; 23 | }; 24 | -------------------------------------------------------------------------------- /memcached/allcommands.txt: -------------------------------------------------------------------------------- 1 | //run docker login (create an account hub.docker.com) 2 | //to spin up a memcached container (remove -d to see if you get any errors) 3 | docker run --name mem1 -p 11211:11211 -d memcached 4 | docker run --name mem2 -p 11212:11211 -d memcached 5 | docker run --name mem3 -p 11213:11211 -d memcached 6 | docker run --name mem4 -p 11214:11211 -d memcached 7 | 8 | //memcached commands 9 | //command keyname flags expiry datalength 10 | set foo 0 3600 2 11 | get foo 12 | stats 13 | stats slabs 14 | 15 | -------------------------------------------------------------------------------- /const/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 25 | 26 | -------------------------------------------------------------------------------- /sidecar2/log.js: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const app = express() 3 | app.use(express.json()) 4 | 5 | app.post("/", (req, res) => { 6 | log(req.body.num) 7 | //res.setHeader("content-type", "application/json") 8 | res.send(JSON.stringify({"success":true})) 9 | }) 10 | 11 | app.listen(8080, 'localhost', () => console.log("Listening on port 8080")) 12 | 13 | 14 | function log(num) { 15 | const message= `User input is ${num} the sqr it ${num*num}` 16 | console.log( `${Date()} : ${message}` ) 17 | } -------------------------------------------------------------------------------- /docker/app/node_modules/qs/test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "array-bracket-newline": 0, 4 | "array-element-newline": 0, 5 | "consistent-return": 2, 6 | "function-paren-newline": 0, 7 | "max-lines": 0, 8 | "max-lines-per-function": 0, 9 | "max-nested-callbacks": [2, 3], 10 | "max-statements": 0, 11 | "no-buffer-constructor": 0, 12 | "no-extend-native": 0, 13 | "no-magic-numbers": 0, 14 | "object-curly-newline": 0, 15 | "sort-keys": 0 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /express-node/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | app.use(express.text()); 4 | 5 | app.get("/", (_,res)=> res.sendFile(__dirname + "/index.html")); 6 | app.post("/", (req, res) => { 7 | 8 | console.log(req.query) 9 | res.sendStatus(204) 10 | //const products = req.body; 11 | //console.log(`Got ${products.length} products from client`) 12 | //res.send({"result": `Got ${products.length} products from client`}) 13 | }) 14 | 15 | app.listen(8080); 16 | console.log("Listening on 8080") -------------------------------------------------------------------------------- /kafka/docker-compose-back.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zookeeper: 3 | image: zookeeper 4 | hostname: zookeeper 5 | ports: 6 | - 2181:2181 7 | 8 | kafka: 9 | restart: always 10 | image: ches/kafka 11 | hostname: localhost 12 | ports: 13 | - "9092:9092" 14 | environment: 15 | KAFKA_ADVERTISED_HOST_NAME: 192.168.7.179 16 | ZOOKEEPER_IP: 192.168.7.179 17 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 18 | ALLOW_PLAINTEXT_LISTENER: 1 19 | 20 | depends_on: 21 | - zookeeper 22 | -------------------------------------------------------------------------------- /xss/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | XSS test 7 | 8 | 9 | 10 |

Demo - XSS Stored Attacks and Reflected XSS Attacks

11 |
12 |

Products Catalog

13 |

14 | 15 | 16 |
    17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /microservices-with-db/pg11/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | pg: 5 | image: postgres:11 6 | environment: 7 | - POSTGRES_PASSWORD=postgres 8 | ob: 9 | image: ob 10 | environment: 11 | - PGHOST=pg 12 | - PORT=8080 13 | ports: 14 | - "8080:8080" 15 | depends_on: 16 | - pg 17 | test: 18 | build: 19 | context: ../test 20 | environment: 21 | - PORT=8080 22 | depends_on: 23 | - ob -------------------------------------------------------------------------------- /docker/app/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")(); 2 | const appid = process.env.APPID; 3 | 4 | app.get("/", (req,res) => 5 | res.send(`appid: ${appid} home page: says hello!`)) 6 | 7 | app.get("/app1", (req,res) => 8 | res.send(`appid: ${appid} app1 page: says hello!`)) 9 | 10 | app.get("/app2", (req,res) => 11 | res.send(`appid: ${appid} app2 page: says hello!`)) 12 | 13 | app.get("/admin", (req,res) => 14 | res.send(`appid: ${appid} ADMIN page: very few people should see this`)) 15 | 16 | app.listen(9999, ()=>console.log(`${appid} is listening on 9999`)) 17 | -------------------------------------------------------------------------------- /docker/app/node_modules/qs/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | max_line_length = 160 11 | 12 | [test/*] 13 | max_line_length = off 14 | 15 | [*.md] 16 | max_line_length = off 17 | 18 | [*.json] 19 | max_line_length = off 20 | 21 | [Makefile] 22 | max_line_length = off 23 | 24 | [CHANGELOG.md] 25 | indent_style = space 26 | indent_size = 2 27 | 28 | [LICENSE] 29 | indent_size = 2 30 | max_line_length = off 31 | -------------------------------------------------------------------------------- /javascript_postgres/fullTable.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | const client = new Client({ 3 | user: "postgres", 4 | password: "postgres", 5 | host: "husseinmac", 6 | port: 5432, 7 | database: "husseindb" 8 | }) 9 | 10 | client.connect() 11 | .then(() => console.log("Connected successfuly")) 12 | .then(() => client.query("insert into employees values ($1, $2)",[1001, 'John'])) 13 | .then(() => client.query("select * from employees")) 14 | .then(results => console.table(results.rows)) 15 | .catch(e => console.log(e)) 16 | .finally(() => client.end()) -------------------------------------------------------------------------------- /traefik/traefik.yaml: -------------------------------------------------------------------------------- 1 | # Static configuration 2 | entryPoints: 3 | unsecure: 4 | address: :80 5 | secure: 6 | address: :443 7 | 8 | certificatesResolvers: 9 | myresolver: 10 | acme: 11 | email: h@husseinnasser.com 12 | storage: acme.json 13 | httpChallenge: 14 | entryPoint: unsecure 15 | 16 | #traefikdemo.ddns.net 17 | providers: 18 | # Enable the file provider to define routers / middlewares / services in file 19 | file: 20 | filename: tls.yaml 21 | watch: true -------------------------------------------------------------------------------- /mjs-github-shared-code-browser/github.mjs: -------------------------------------------------------------------------------- 1 | export class GitHub { 2 | 3 | constructor () { 4 | 5 | } 6 | 7 | async getFetch() { 8 | try { 9 | const nodeFetch = await import ("node-fetch"); //require 10 | return nodeFetch.default; 11 | } 12 | catch (ex){ 13 | //browser 14 | return fetch; 15 | 16 | } 17 | 18 | } 19 | 20 | async emojis() { 21 | 22 | const f = await this.getFetch(); 23 | return f("https://api.github.com/emojis") ; 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /isprime-non-blocking/index.js: -------------------------------------------------------------------------------- 1 | const app = require ("express")(); 2 | const {fork} = require("child_process") 3 | 4 | app.get("/isprime", (req, res) => { 5 | 6 | const childProcess = fork('./isprime.js'); 7 | childProcess.send({"number": parseInt(req.query.number)}) 8 | childProcess.on("message", message => res.send(message)) 9 | } ) 10 | 11 | app.listen(8081, ()=>console.log("Listening on 8081") ) 12 | 13 | 14 | /* 15 | 16 | 2367949 (16 ms) 17 | 43686389 (200 ms) 18 | 93686687 (500 ms) 19 | 936868033(4 seconds) 20 | 29355126551 (very long time) 21 | 22 | */ 23 | -------------------------------------------------------------------------------- /docker/app/node_modules/content-type/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.0.4 / 2017-09-11 2 | ================== 3 | 4 | * perf: skip parameter parsing when no parameters 5 | 6 | 1.0.3 / 2017-09-10 7 | ================== 8 | 9 | * perf: remove argument reassignment 10 | 11 | 1.0.2 / 2016-05-09 12 | ================== 13 | 14 | * perf: enable strict mode 15 | 16 | 1.0.1 / 2015-02-13 17 | ================== 18 | 19 | * Improve missing `Content-Type` header error message 20 | 21 | 1.0.0 / 2015-02-01 22 | ================== 23 | 24 | * Initial implementation, derived from `media-typer@0.3.0` 25 | -------------------------------------------------------------------------------- /iptables/iptables-dnat-: -------------------------------------------------------------------------------- 1 | A ---> B ---> C 2 | 3 | A 4 | //A:55 -> B:81 5 | B 6 | //A:55 -> B:81 7 | //A:55 -> C:8080 8 | //B:81 -> C:8080 9 | 10 | 11 | //8080->8080 12 | sudo iptables --in-interface wlan0 --append PREROUTING --table nat --protocol tcp --destination 192.168.254.47 --dport 81 --jump DNAT --to-destination 192.168.254.10:8080 13 | 14 | 15 | sudo iptables --append POSTROUTING --table nat --protocol tcp --destination 192.168.254.10 --dport 8080 --jump SNAT --to-source 192.168.254.47 16 | 17 | 18 | 19 | sudo iptables -t nat -A POSTROUTING -p tcp --dport 81 -j MASQUERADE 20 | -------------------------------------------------------------------------------- /microservices-example/app/index.js: -------------------------------------------------------------------------------- 1 | const app = require("express")(); 2 | const appid = process.env.APPID; 3 | 4 | app.get("/", (req,res) => 5 | res.send(`appid: ${appid} home page: says hello!`)) 6 | 7 | app.get("/app1", (req,res) => 8 | res.send(`appid: ${appid} app1 page: says hello!`)) 9 | 10 | app.get("/app2", (req,res) => 11 | res.send(`appid: ${appid} app2 page: says hello!`)) 12 | 13 | app.get("/admin", (req,res) => 14 | res.send(`appid: ${appid} ADMIN page: very few people should see this`)) 15 | 16 | app.listen(appid, ()=>console.log(`${appid} is listening on ${appid}`)) 17 | -------------------------------------------------------------------------------- /sidecar/index.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch") 2 | 3 | const num1 = 100 4 | log(num1) 5 | 6 | const num2 = 200 7 | log(num2) 8 | 9 | const num3 = 200 10 | log(num3) 11 | 12 | function log(num){ 13 | const payLoad = { 14 | "num": num 15 | } 16 | 17 | fetch("http://localhost:8080", 18 | { 19 | method:"post", 20 | headers: { 21 | "content-type": "application/json" 22 | }, 23 | body: JSON.stringify(payLoad) 24 | }) 25 | .then(a => a.json()) 26 | .then(console.log) 27 | .catch(console.error) 28 | 29 | } -------------------------------------------------------------------------------- /docker/app/node_modules/media-typer/HISTORY.md: -------------------------------------------------------------------------------- 1 | 0.3.0 / 2014-09-07 2 | ================== 3 | 4 | * Support Node.js 0.6 5 | * Throw error when parameter format invalid on parse 6 | 7 | 0.2.0 / 2014-06-18 8 | ================== 9 | 10 | * Add `typer.format()` to format media types 11 | 12 | 0.1.0 / 2014-06-17 13 | ================== 14 | 15 | * Accept `req` as argument to `parse` 16 | * Accept `res` as argument to `parse` 17 | * Parse media type with extra LWS between type and first parameter 18 | 19 | 0.0.0 / 2014-06-13 20 | ================== 21 | 22 | * Initial implementation 23 | -------------------------------------------------------------------------------- /docker/app/node_modules/methods/HISTORY.md: -------------------------------------------------------------------------------- 1 | 1.1.2 / 2016-01-17 2 | ================== 3 | 4 | * perf: enable strict mode 5 | 6 | 1.1.1 / 2014-12-30 7 | ================== 8 | 9 | * Improve `browserify` support 10 | 11 | 1.1.0 / 2014-07-05 12 | ================== 13 | 14 | * Add `CONNECT` method 15 | 16 | 1.0.1 / 2014-06-02 17 | ================== 18 | 19 | * Fix module to work with harmony transform 20 | 21 | 1.0.0 / 2014-05-08 22 | ================== 23 | 24 | * Add `PURGE` method 25 | 26 | 0.1.0 / 2013-10-28 27 | ================== 28 | 29 | * Add `http.METHODS` support 30 | -------------------------------------------------------------------------------- /kafka/commands.txt: -------------------------------------------------------------------------------- 1 | 2 | //if you ever mess up or you want to start fresh just stop and remove the containers and rerun the command 3 | //stop and remove all containers 4 | docker stop zookeeper kafka 5 | docker rm zookeeper kafka 6 | //run zookeeper 7 | docker run --name zookeeper -p 2181:2181 -d zookeeper 8 | 9 | //run kafka (replace husseinmac with your hostname where docker is running) 10 | docker run -p 9092:9092 --name kafka -e KAFKA_ZOOKEEPER_CONNECT=husseinmac:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://husseinmac:9092 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 -d confluentinc/cp-kafka 11 | -------------------------------------------------------------------------------- /microservices-with-db/test/index.js: -------------------------------------------------------------------------------- 1 | //testing against all flavors of databases 2 | const fetch = require("node-fetch"); 3 | 4 | const OBPORT = process.env.OBPORT; 5 | const OBHOST = process.env.OBHOST; 6 | console.log("Testing App started on PORT " + OBHOST + OBPORT) 7 | async function run () { 8 | try{ 9 | const res = await fetch(`http://${OBHOST}:${OBPORT}/`) 10 | const js = await res.json(); 11 | console.log(JSON.stringify(js)); 12 | } 13 | catch(ex) 14 | { 15 | console.error(ex) 16 | process.exit(1) 17 | } 18 | 19 | } 20 | 21 | run(); -------------------------------------------------------------------------------- /mongodb-js/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/test.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /protobuff/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/index2.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /sidecartutorial/index.js: -------------------------------------------------------------------------------- 1 | const fetch = require("node-fetch") 2 | 3 | const num1 = 10 4 | const num2 = 20 5 | const num3 = 30 6 | log(num1) 7 | log(num2) 8 | log(num3) 9 | 10 | function log(num){ 11 | 12 | const payLoad = { 13 | "num":num 14 | } 15 | fetch("http://localhost:8080", 16 | { 17 | method: "POST", 18 | headers : { 19 | "content-type": "application/json" 20 | }, 21 | body: JSON.stringify(payLoad) 22 | } 23 | ) 24 | .then(a => a.json()) 25 | .then(console.log) 26 | .catch(console.error) 27 | } 28 | 29 | -------------------------------------------------------------------------------- /http-module/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "pwa-node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/listen.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /websocket-demo/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/simple.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /authentication/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/auth_method5.mjs" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /lazy-vs-eager-loading/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/lazy.mjs" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /simple-uploader/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "pwa-node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/index.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /jwt-course/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/jwt-final/jwtAuth.mjs" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /mjs-github-shared-code-browser/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/index.mjs" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /filereader/index.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const http = require("http"); 3 | const httpServer = http.createServer(); 4 | httpServer.on("listening", () => console.log("listening")); 5 | httpServer.on("request", (req, res) => { 6 | //console.log(req.url) 7 | if (req.url === "/"){ res.end(fs.readFileSync("index.html")); return;} 8 | const filename = req.headers["upload-id"]; 9 | req.on('data', chunk => { 10 | fs.appendFileSync(filename,chunk ) 11 | console.log(`Received ${chunk.length} bytes of data.`); 12 | }); 13 | 14 | res.end("done"); 15 | }) 16 | 17 | httpServer.listen(8080); -------------------------------------------------------------------------------- /httpserver/index.js: -------------------------------------------------------------------------------- 1 | const http = require("http"); 2 | 3 | //create a raw http server (this will help us create the TCP which will then pass to the websocket to do the job) 4 | const httpserver = http.createServer((req, res) => { 5 | 6 | console.log("we have received a request"); 7 | res.statusCode = 200 8 | res.end("hello") 9 | }) 10 | 11 | httpserver.listen( 8080, "0.0.0.0", () => console.log("My server is listening on port 8080")) 12 | 13 | 14 | //client code 15 | //let ws = new WebSocket("ws://localhost:8080"); 16 | //ws.onmessage = message => console.log(`Received: ${message.data}`); 17 | //ws.send("Hello! I'm client") -------------------------------------------------------------------------------- /learning-react/my-app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /ws-live-chat-system/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : '3' 2 | 3 | services: 4 | lb: 5 | image: haproxy 6 | ports: 7 | - "8080:8080" 8 | volumes: 9 | - ./haproxy:/usr/local/etc/haproxy 10 | ws1: 11 | image: wsapp 12 | environment: 13 | - APPID=1111 14 | ws2: 15 | image: wsapp 16 | environment: 17 | - APPID=2222 18 | ws3: 19 | image: wsapp 20 | environment: 21 | - APPID=3333 22 | ws4: 23 | image: wsapp 24 | environment: 25 | - APPID=4444 26 | rds: 27 | image: redis -------------------------------------------------------------------------------- /microservices-example/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version : '3' 2 | 3 | services: 4 | lb: 5 | image: haproxy 6 | ports: 7 | - "8080:8080" 8 | volumes: 9 | - ./haproxy:/usr/local/etc/haproxy 10 | nodeapp1: 11 | image: nodeapp 12 | environment: 13 | - APPID=1111 14 | nodeapp2: 15 | image: nodeapp 16 | environment: 17 | - APPID=2222 18 | nodeapp3: 19 | image: nodeapp 20 | environment: 21 | - APPID=3333 22 | nodeapp4: 23 | image: nodeapp 24 | environment: 25 | - APPID=4444 26 | -------------------------------------------------------------------------------- /node-http2/index.js: -------------------------------------------------------------------------------- 1 | const http2 = require ("http2") 2 | const fs = require("fs") 3 | 4 | const server = http2.createSecureServer({ 5 | "key": fs.readFileSync("localhost-private.pem"), 6 | "cert": fs.readFileSync("localhost-cert.pem") 7 | }) 8 | 9 | server.on("stream", (stream, headers) => { 10 | console.log(stream.id); 11 | stream.respond({ 12 | "content-type": "application/json", 13 | "status": 200 14 | }) 15 | 16 | stream.end(JSON.stringify({ 17 | "user": "Hussein", 18 | "id": 823 19 | })) 20 | }) 21 | 22 | 23 | server.listen(443); 24 | console.log("listening on port 443"); 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /samesite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 | 11 | 12 | 22 | 23 | -------------------------------------------------------------------------------- /docker/app/node_modules/toidentifier/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * toidentifier 3 | * Copyright(c) 2016 Douglas Christopher Wilson 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Module exports. 9 | * @public 10 | */ 11 | 12 | module.exports = toIdentifier 13 | 14 | /** 15 | * Trasform the given string into a JavaScript identifier 16 | * 17 | * @param {string} str 18 | * @returns {string} 19 | * @public 20 | */ 21 | 22 | function toIdentifier (str) { 23 | return str 24 | .split(' ') 25 | .map(function (token) { 26 | return token.slice(0, 1).toUpperCase() + token.slice(1) 27 | }) 28 | .join('') 29 | .replace(/[^ _0-9a-z]/gi, '') 30 | } 31 | -------------------------------------------------------------------------------- /cookie/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

My page

11 | 14 | visit example 15 | 19 | 20 | -------------------------------------------------------------------------------- /traefik/wrr.yaml: -------------------------------------------------------------------------------- 1 | http: 2 | routers: 3 | allbackendrouter: 4 | rule: "Host(`husseinmac`)" 5 | service: wrr 6 | 7 | services: 8 | wrr: 9 | weighted: 10 | services: 11 | - name: backend1 12 | weight: 4 13 | - name: backend2 14 | weight: 1 15 | backend1: 16 | loadBalancer: 17 | servers: 18 | - url: "http://husseinmac:1111/" 19 | backend2: 20 | loadBalancer: 21 | servers: 22 | - url: "http://husseinmac:2222/" -------------------------------------------------------------------------------- /webrtc/readme.txt: -------------------------------------------------------------------------------- 1 | Open two browsers 2 | Open DevTools on both 3 | Paste peerA.js content in first browser dev tools 4 | Copy the SDP offer generated JSON 5 | Got to the second browser and create "offer" object and set it to the SDP you copied (signled) 6 | Paste peerB.js content in second browser dev tools 7 | Go back to First browser (peer A) and paste the content of peerA_Final.js 8 | use sendChannel.send() to send data from peerA 9 | use remoteConnection.channel.send() to send data from peerB 10 | 11 | 12 | Watch video here 13 | https://www.youtube.com/watch?v=FExZvpVvYxA 14 | minute 46:00 15 | 16 | You can find some other demos: https://webrtc.github.io/samples/ 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "javascript_playground", 3 | "version": "1.0.0", 4 | "description": "Javascript playground tutorials", 5 | "main": "index.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/hnasr/javascript_playground.git" 15 | }, 16 | "keywords": [], 17 | "author": "", 18 | "license": "ISC", 19 | "bugs": { 20 | "url": "https://github.com/hnasr/javascript_playground/issues" 21 | }, 22 | "homepage": "https://github.com/hnasr/javascript_playground#readme" 23 | } 24 | -------------------------------------------------------------------------------- /microservices-with-db/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/app/init.js", 15 | "envFile": "${workspaceFolder}/.env" 16 | 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /traefik/blockadmin.yaml: -------------------------------------------------------------------------------- 1 | http: 2 | routers: 3 | allbackendrouter: 4 | rule: "Host(`husseinmac`)" 5 | service: allbackend 6 | adminblocker: 7 | rule: "Host(`husseinmac`) && Path(`/admin`)" 8 | service: blackhole 9 | services: 10 | blackhole: 11 | loadBalancer: 12 | servers: 13 | allbackend: 14 | loadBalancer: 15 | servers: 16 | - url: "http://husseinmac:1111/" 17 | - url: "http://husseinmac:2222/" 18 | - url: "http://husseinmac:3333/" 19 | - url: "http://husseinmac:4444/" -------------------------------------------------------------------------------- /xmpp-demo/index.js: -------------------------------------------------------------------------------- 1 | const xmpp = require("simple-xmpp"); 2 | 3 | xmpp.on ("online", data => { 4 | console.log("Hey you are online! ") 5 | console.log(`Connected as ${data.jid.user}`) 6 | send(); 7 | }) 8 | 9 | function send () { 10 | setTimeout(send, 5000); 11 | xmpp.send("hussein@localhost", `hi! ${Date.now()}`) 12 | } 13 | xmpp.on("error", error => 14 | console.log(`something went wrong!${error} `)) 15 | 16 | xmpp.on("chat", (from, message)=>{ 17 | console.log(`Got a message! ${message} from ${from}`) 18 | }) 19 | 20 | xmpp.connect({ 21 | "jid": "admin@localhost", 22 | "password": "password", 23 | "host": "localhost", 24 | "port": 5222 25 | }) -------------------------------------------------------------------------------- /jsmodules/jsmodules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | JS Modules 9 | 10 | 11 | 22 | 23 | -------------------------------------------------------------------------------- /rtmp/app1.js: -------------------------------------------------------------------------------- 1 | const NodeMediaServer = require('node-media-server'); 2 | 3 | const config = { 4 | rtmp: { 5 | port: 1935, 6 | chunk_size: 60000, 7 | gop_cache: true, 8 | ping: 30, 9 | ping_timeout: 60 10 | }, 11 | http: { 12 | port: 8000, 13 | allow_origin: '*' 14 | }, 15 | 16 | relay: { 17 | ffmpeg: '/usr/local/bin/ffmpeg', 18 | tasks: [ 19 | { 20 | app: 'live', 21 | mode: 'push', 22 | edge: 'rtmp://localhost:1936', 23 | }, 24 | { 25 | app: 'live', 26 | mode: 'push', 27 | edge: 'rtmp://localhost:1937', 28 | } 29 | ] 30 | } 31 | }; 32 | 33 | var nms = new NodeMediaServer(config) 34 | nms.run(); 35 | -------------------------------------------------------------------------------- /xmlpp/index.js: -------------------------------------------------------------------------------- 1 | var xmpp = require('simple-xmpp'); 2 | 3 | xmpp.on('online', function(data) { 4 | console.log('Connected with JID: ' + data.jid.user); 5 | console.log('Yes, I\'m connected!'); 6 | //send a message every 3 second 7 | send() 8 | }); 9 | 10 | function send(){ 11 | xmpp.send(`admin@localhost`, `yo!${Date.now()}`) 12 | setTimeout(send, 10000) 13 | } 14 | xmpp.on('chat', function(from, message) { 15 | console.log(`Got message! ${message}`) 16 | }); 17 | 18 | xmpp.on('error', function(err) { 19 | console.error(err); 20 | }); 21 | 22 | 23 | xmpp.connect({ 24 | jid: "hussein@localhost", 25 | password: "password", 26 | host: 'localhost', 27 | port: 5222 28 | }); 29 | 30 | -------------------------------------------------------------------------------- /zeromq-simplequeue/server.js: -------------------------------------------------------------------------------- 1 | const zmq = require("zeromq"); 2 | 3 | const sock = new zmq.Push(); 4 | run(); 5 | async function run () { 6 | 7 | await sock.bind("tcp://127.0.0.1:7000"); 8 | console.log("Server is ready listening on port 7000"); 9 | console.log("Press any key to start sending the jobs!") 10 | process.stdin.once("data", send); 11 | } 12 | 13 | //sending the jobs to the workers 14 | async function send () { 15 | 16 | console.log("About to send jobs!"); 17 | for (let i = 0 ;i < 100; i ++) { 18 | await sock.send(`sending job ${i}`); 19 | //wait 500ms 20 | await new Promise(resolve => setTimeout(resolve, 500)) 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /xmpp-demo/hussein.js: -------------------------------------------------------------------------------- 1 | const xmpp = require("simple-xmpp"); 2 | //hussein 3 | xmpp.on ("online", data => { 4 | console.log("Hey you are online! ") 5 | console.log(`Connected as ${data.jid.user}`) 6 | send(); 7 | }) 8 | 9 | function send () { 10 | setTimeout(send, 5000); 11 | xmpp.send("admin@localhost", `hi! ${Date.now()}`) 12 | } 13 | xmpp.on("error", error => 14 | console.log(`something went wrong!${error} `)) 15 | 16 | xmpp.on("chat", (from, message)=>{ 17 | console.log(`Got a message! ${message} from ${from}`) 18 | }) 19 | 20 | xmpp.connect({ 21 | "jid": "hussein@localhost", 22 | "password": "password", 23 | "host": "localhost", 24 | "port": 5222 25 | }) -------------------------------------------------------------------------------- /rabbitmq/publisher.js: -------------------------------------------------------------------------------- 1 | /* RabbitMQ */ 2 | const amqp = require("amqplib"); 3 | 4 | const msg = {number: process.argv[2]} 5 | connect(); 6 | async function connect() { 7 | 8 | try { 9 | const amqpServer = "amqp://localhost:5672" 10 | const connection = await amqp.connect(amqpServer) 11 | const channel = await connection.createChannel(); 12 | await channel.assertQueue("jobs"); 13 | await channel.sendToQueue("jobs", Buffer.from(JSON.stringify(msg))) 14 | console.log(`Job sent successfully ${msg.number}`); 15 | await channel.close(); 16 | await connection.close(); 17 | } 18 | catch (ex){ 19 | console.error(ex) 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /xmlpp/admin.js: -------------------------------------------------------------------------------- 1 | var xmpp = require('simple-xmpp'); 2 | 3 | xmpp.on('online', function(data) { 4 | console.log('Connected with JID: ' + data.jid.user); 5 | console.log('Yes, I\'m connected!'); 6 | //send a message every 3 second 7 | send() 8 | }); 9 | 10 | function send(){ 11 | 12 | xmpp.send(`hussein@localhost`, `yo!${Date.now()}`) 13 | setTimeout(send, 10000) 14 | } 15 | xmpp.on('chat', function(from, message) { 16 | console.log(`Got message! ${message} from ${from}`) 17 | }); 18 | 19 | xmpp.on('error', function(err) { 20 | console.error(err); 21 | }); 22 | 23 | 24 | xmpp.connect({ 25 | jid: "admin@localhost", 26 | password: "password", 27 | host: 'localhost', 28 | port: 5222 29 | }); 30 | 31 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /iptables/ptables-random-loadbalancer: -------------------------------------------------------------------------------- 1 | ptables-random-loadbalancer 2 | 3 | 4 | sudo iptables --table nat --delete PREROUTING 1 5 | 6 | 7 | sudo iptables --table nat --append PREROUTING --destination 192.168.254.47 --protocol tcp --dport 80 --match statistic --mode random —probability 0.33 --jump DNAT --to-destination 192.168.254.10:1111 8 | 9 | sudo iptables --table nat --append PREROUTING --destination 192.168.254.47 --protocol tcp --dport 80 --match statistic --mode random —probability 0.5 --jump DNAT --to-destination 192.168.254.10:2222 10 | 11 | sudo iptables --table nat --append PREROUTING --destination 192.168.254.47 --protocol tcp --dport 80 --jump DNAT --to-destination 192.168.254.10:3333 12 | 13 | 14 | -------------------------------------------------------------------------------- /deno-https/index.js: -------------------------------------------------------------------------------- 1 | import {serve, serveTLS} from "https://deno.land/std@0.59.0/http/server.ts" 2 | /* 3 | const server = serveTLS({ 4 | "hostname": "127.0.0.1", 5 | "port": 8080, 6 | "certFile" :"cert.pem", 7 | "keyFile": "private.pem" 8 | })*/ 9 | 10 | const server = serve({ 11 | "hostname": "127.0.0.1", 12 | "port": 8080 13 | }) 14 | 15 | console.log("Listening on port 8080"); 16 | 17 | for await (const req of server) { 18 | console.log(req.url); 19 | const headers = new Headers(); 20 | headers.append("content-type", "application/json"); 21 | req.respond({ 22 | "headers": headers, 23 | "body": JSON.stringify({"username": "HusseinNasser", "id": 1234}) 24 | }) 25 | } -------------------------------------------------------------------------------- /microservices-with-db/pg12/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | 3 | services: 4 | pg: 5 | image: postgres:12 6 | environment: 7 | - POSTGRES_PASSWORD=postgres 8 | ob: 9 | #build: ../app 10 | image: ob 11 | environment: 12 | - PGHOST=pg 13 | - PORT=8080 14 | ports: 15 | - "8080:8080" 16 | depends_on: 17 | - pg 18 | restart: on-failure:10 19 | test: 20 | #build: ../test 21 | image: test 22 | environment: 23 | - OBHOST=ob 24 | - OBPORT=8080 25 | depends_on: 26 | - pg 27 | - ob 28 | restart: on-failure:10 29 | -------------------------------------------------------------------------------- /jspostgresweb/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/server.js", 15 | "env": { 16 | "DBHOST": "husseinmac", 17 | "DBport":"5432" 18 | }, 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /nginx-websockets-practice/index.js: -------------------------------------------------------------------------------- 1 | const http = require("http"); 2 | const WebSocketServer = require("websocket").server; 3 | const httpServer = http.createServer(); 4 | const websocketServer = new WebSocketServer( 5 | {"httpServer": httpServer}) 6 | const PORT = process.argv[2] || 8080; 7 | let connection = null; 8 | httpServer.listen(PORT, () => console.log(`Listening on port ${PORT}`)) 9 | 10 | websocketServer.on("request", request => { 11 | 12 | connection = request.accept(null, request.origin); 13 | connection.on("message", data => { 14 | console.log(`Hey I received a message ${data.utf8Data}`); 15 | connection.send(`Hey Client! Received your message ${data.utf8Data} on ${PORT}`) 16 | }) 17 | }) -------------------------------------------------------------------------------- /simple-uploader/index.js: -------------------------------------------------------------------------------- 1 | const http = require("http"); 2 | const fs = require("fs") 3 | const httpServer = http.createServer(); 4 | httpServer.on("listening", () => console.log("Listening...")); 5 | httpServer.on("request", (req, res) => { 6 | 7 | if (req.url === "/") { 8 | res.end(fs.readFileSync("index.html")); 9 | return; 10 | } 11 | //idempotency 12 | if (req.url === "/upload") { 13 | const fileName = req.headers["file-name"]; 14 | req.on("data", chunk => { 15 | fs.appendFileSync(fileName, chunk) 16 | console.log(`received chunk! ${chunk.length}`) 17 | }) 18 | res.end("uploaded!") 19 | } 20 | 21 | 22 | }) 23 | 24 | httpServer.listen(8080) 25 | 26 | -------------------------------------------------------------------------------- /jwt-course/create.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE public.session_auth 2 | ( 3 | username text COLLATE pg_catalog."default", 4 | password text COLLATE pg_catalog."default", 5 | role text COLLATE pg_catalog."default", 6 | sessionid text COLLATE pg_catalog."default" 7 | ) 8 | 9 | TABLESPACE pg_default; 10 | 11 | ALTER TABLE public.session_auth 12 | OWNER to postgres; 13 | 14 | 15 | 16 | 17 | 18 | CREATE TABLE public.jwt_auth 19 | ( 20 | username text COLLATE pg_catalog."default", 21 | password text COLLATE pg_catalog."default", 22 | role text COLLATE pg_catalog."default", 23 | token text COLLATE pg_catalog."default") 24 | 25 | TABLESPACE pg_default; 26 | 27 | ALTER TABLE public.jwt_auth 28 | OWNER to postgres; 29 | 30 | -------------------------------------------------------------------------------- /kafka/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | zookeeper: 3 | image: zookeeper 4 | hostname: zookeeper 5 | ports: 6 | - 2181:2181 7 | volumes: 8 | - zookeeper_data:/data 9 | - zookeeper_datalog:/datalog 10 | 11 | kafka: 12 | image: ches/kafka 13 | restart: always 14 | hostname: localhost 15 | ports: 16 | - "9092:9092" 17 | environment: 18 | KAFKA_ADVERTISED_HOST_NAME: 192.168.7.179 19 | ZOOKEEPER_IP: 192.168.7.179 20 | KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 21 | ALLOW_PLAINTEXT_LISTENER: 1 22 | depends_on: 23 | - zookeeper 24 | volumes: 25 | - kafka_data:/kafka 26 | 27 | volumes: 28 | zookeeper_data: 29 | zookeeper_datalog: 30 | kafka_data: 31 | -------------------------------------------------------------------------------- /server-sent-events/index.js: -------------------------------------------------------------------------------- 1 | /* Client Code 2 | 3 | let sse = new EventSource("http://localhost:8080/stream"); 4 | sse.onmessage = console.log 5 | 6 | */ 7 | 8 | const app = require("express")(); 9 | 10 | app.get("/", (req, res) => res.send("hello!")); 11 | 12 | app.get("/stream", (req,res) => { 13 | 14 | res.setHeader("Content-Type", "text/event-stream"); 15 | send(res); 16 | 17 | }) 18 | const port = process.env.PORT || 8888; 19 | const serverName = process.env.SERVER_NAME || "sample"; 20 | 21 | let i = 0; 22 | function send (res) { 23 | 24 | res.write("data: " + `hello from ${serverName} ---- [${i++}]\n\n`); 25 | 26 | 27 | setTimeout(() => send(res), 1000); 28 | } 29 | 30 | app.listen(port) 31 | console.log(`Listening on ${port}`) -------------------------------------------------------------------------------- /rtmp/readme.txt: -------------------------------------------------------------------------------- 1 | Load Balance multiple RTMP Servers to Horizontally Scale Streaming ( With Node Media Server and HAProxy) 2 | 3 | In this video I will show case the new Node Media Server , a Node JS implementation of an RTMP server used for streaming setup. I will show how to install and spinup an RTMP server and stream to it from OBS. Then I will spin up multiple ones, then I’ll show how to relay the stream to multiple RTMP servers and finally I will use HAProxy to load balance the stream consumption to achieve high availability. 4 | 5 | 6 | https://www.npmjs.com/package/node-media-server 7 | 8 | 9 | 10 | 0:00 Intro 11 | 2:00 Single RTMP Server 12 | 6:00 Multiple RTMP Servers 13 | 7:00 Relay Server 14 | 12:00 Load Balancing RTMP Servers 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /staticpage/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello world! 4 |
5 | 6 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /staticpage2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello world! 4 |
5 | 6 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docker/app/node_modules/qs/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | 4 | "extends": "@ljharb", 5 | 6 | "rules": { 7 | "complexity": 0, 8 | "consistent-return": 1, 9 | "func-name-matching": 0, 10 | "id-length": [2, { "min": 1, "max": 25, "properties": "never" }], 11 | "indent": [2, 4], 12 | "max-lines-per-function": [2, { "max": 150 }], 13 | "max-params": [2, 14], 14 | "max-statements": [2, 52], 15 | "multiline-comment-style": 0, 16 | "no-continue": 1, 17 | "no-magic-numbers": 0, 18 | "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], 19 | "operator-linebreak": [2, "before"], 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rabbitmq/scripts.md: -------------------------------------------------------------------------------- 1 | ## docker commands 2 | 3 | ### Spin rabbitmq server docker 4 | docker run --name rabbitmq -p 5672:5672 -d rabbitmq 5 | 6 | ### Spin rabbitmq server HTTP server docker 7 | 8 | docker run --name rabbitmq -p 5672:5672 -p 15672:15672 -d rabbitmq:3-management 9 | 10 | 11 | 12 | HTTP 13 | fetch("http://localhost:15672/api/vhosts”, {headers: {"Authorization" : `Basic ${btoa('guest:guest')}`}}).then(a=>a.json()).then(console.log) 14 | 15 | 16 | fetch("http://localhost:15672/api/channels", {headers: {"Authorization" : `Basic ${btoa('guest:guest')}`}}).then(a=>a.json()).then(console.log) 17 | 18 | 19 | fetch("http://localhost:15672/api/queues", {headers: {"Authorization" : `Basic ${btoa('guest:guest')}`}}).then(a=>a.json()).then(console.log) 20 | 21 | -------------------------------------------------------------------------------- /lazy-vs-eager-loading/lazy.mjs: -------------------------------------------------------------------------------- 1 | import fetch from "node-fetch"; 2 | import Express from "express"; 3 | const url = "https://pomber.github.io/covid19/timeseries.json" 4 | const app = new Express(); 5 | let timeline = null; 6 | 7 | async function loadTimeline() { 8 | const fromDate = new Date(); 9 | if (timeline == null) { 10 | const r = await fetch(url) 11 | timeline = await r.json(); 12 | } 13 | const toDate = new Date(); 14 | console.log("Loading time: " + (toDate.getTime() - fromDate.getTime())); 15 | 16 | return timeline; 17 | } 18 | 19 | app.get("/:country", async (req, res) => { 20 | const result = await loadTimeline(); 21 | res.send(result[req.params.country]) 22 | }); 23 | 24 | app.listen(8080, ()=>console.log("listening..8080")) -------------------------------------------------------------------------------- /lazy-vs-eager-loading/eager.mjs: -------------------------------------------------------------------------------- 1 | import fetch from "node-fetch"; 2 | import Express from "express"; 3 | const url = "https://pomber.github.io/covid19/timeseries.json" 4 | const app = new Express(); 5 | let timeline = null; 6 | 7 | async function loadTimeline() { 8 | const fromDate = new Date(); 9 | if (timeline == null) { 10 | const r = await fetch(url) 11 | timeline = await r.json(); 12 | } 13 | const toDate = new Date(); 14 | console.log("Loading time: " + (toDate.getTime() - fromDate.getTime())); 15 | 16 | return timeline; 17 | } 18 | 19 | app.get("/:country", async (req, res) => { 20 | const result = await loadTimeline(); 21 | res.send(result[req.params.country]) 22 | }); 23 | 24 | loadTimeline(); 25 | app.listen(8080, ()=>console.log("listening..8080")) -------------------------------------------------------------------------------- /mongodb-js/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mongodb-js", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "node-addon-api": { 8 | "version": "1.7.2", 9 | "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", 10 | "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" 11 | }, 12 | "sslkeylog": { 13 | "version": "0.2.2", 14 | "resolved": "https://registry.npmjs.org/sslkeylog/-/sslkeylog-0.2.2.tgz", 15 | "integrity": "sha512-Ssh/jEVcGaAYKOt7QnXR4Iv4nPBd1/Ev0vwyd99Uij7QnhCv0T2xNDP1E+jjAfn6tbJ1FLzSLBWAE4YqRyreSQ==", 16 | "requires": { 17 | "node-addon-api": "^1.6.1" 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /nginx-websockets/ws.cfg: -------------------------------------------------------------------------------- 1 | http { 2 | 3 | 4 | upstream allbackend { 5 | server 127.0.0.1:2222; 6 | server 127.0.0.1:3333; 7 | server 127.0.0.1:4444; 8 | server 127.0.0.1:5555; 9 | } 10 | 11 | 12 | server { 13 | listen 80; 14 | location / { 15 | root /Users/HusseinNasser/javascript/javascript_playground/nginx-websockets/; 16 | 17 | } 18 | 19 | 20 | location /wsapp/ { 21 | proxy_pass http://allbackend; 22 | proxy_http_version 1.1; 23 | proxy_set_header Upgrade $http_upgrade; 24 | proxy_set_header Connection "Upgrade"; 25 | proxy_set_header Host $host; 26 | } 27 | 28 | 29 | } 30 | 31 | 32 | } 33 | 34 | # due to some reasons, NGINX requires this block! 35 | events { } 36 | 37 | -------------------------------------------------------------------------------- /samplejson/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |

Lazy load images with Fetch!

11 | 12 | 13 | 24 | 25 | -------------------------------------------------------------------------------- /traefik/tls.yaml: -------------------------------------------------------------------------------- 1 | http: 2 | routers: 3 | unsecurerouter: 4 | rule: "Host(`traefikdemo2.ddns.net`)" 5 | service: allbackend 6 | allbackendrouter: 7 | rule: "Host(`traefikdemo2.ddns.net`)" 8 | service: allbackend 9 | tls: 10 | certResolver: myresolver 11 | options: tlsoptions 12 | services: 13 | allbackend: 14 | loadBalancer: 15 | servers: 16 | - url: "http://husseinmac:1111/" 17 | - url: "http://husseinmac:2222/" 18 | - url: "http://husseinmac:3333/" 19 | - url: "http://husseinmac:4444/" 20 | 21 | tls: 22 | options: 23 | tlsoptions: 24 | minVersion: VersionTLS12 -------------------------------------------------------------------------------- /zombie-cookies-demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Cookie test 8 | 9 | 10 | 11 |
12 | 23 | 24 | -------------------------------------------------------------------------------- /docker/app/node_modules/inherits/inherits_browser.js: -------------------------------------------------------------------------------- 1 | if (typeof Object.create === 'function') { 2 | // implementation from standard node.js 'util' module 3 | module.exports = function inherits(ctor, superCtor) { 4 | ctor.super_ = superCtor 5 | ctor.prototype = Object.create(superCtor.prototype, { 6 | constructor: { 7 | value: ctor, 8 | enumerable: false, 9 | writable: true, 10 | configurable: true 11 | } 12 | }); 13 | }; 14 | } else { 15 | // old school shim for old browsers 16 | module.exports = function inherits(ctor, superCtor) { 17 | ctor.super_ = superCtor 18 | var TempCtor = function () {} 19 | TempCtor.prototype = superCtor.prototype 20 | ctor.prototype = new TempCtor() 21 | ctor.prototype.constructor = ctor 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /docker/app/node_modules/setprototypeof/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Wes Todd 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 10 | SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 12 | OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 13 | CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /zeromq-simplequeue/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "zeromq-simplequeue", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "node-gyp-build": { 8 | "version": "4.2.2", 9 | "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.2.tgz", 10 | "integrity": "sha512-Lqh7mrByWCM8Cf9UPqpeoVBBo5Ugx+RKu885GAzmLBVYjeywScxHXPGLa4JfYNZmcNGwzR0Glu5/9GaQZMFqyA==" 11 | }, 12 | "zeromq": { 13 | "version": "6.0.0-beta.6", 14 | "resolved": "https://registry.npmjs.org/zeromq/-/zeromq-6.0.0-beta.6.tgz", 15 | "integrity": "sha512-wLf6M7pBHijl+BRltUL2VoDpgbQcOZetiX8UzycHL8CcYFxYnRrpoG5fi3UX3+Umavz1lk4/dGaQez8qiDgr/Q==", 16 | "requires": { 17 | "node-gyp-build": "^4.1.0" 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docker/app/node_modules/setprototypeof/test/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | /* eslint-env mocha */ 3 | /* eslint no-proto: 0 */ 4 | var assert = require('assert') 5 | var setPrototypeOf = require('..') 6 | 7 | describe('setProtoOf(obj, proto)', function () { 8 | it('should merge objects', function () { 9 | var obj = { a: 1, b: 2 } 10 | var proto = { b: 3, c: 4 } 11 | var mergeObj = setPrototypeOf(obj, proto) 12 | 13 | if (Object.getPrototypeOf) { 14 | assert.strictEqual(Object.getPrototypeOf(obj), proto) 15 | } else if ({ __proto__: [] } instanceof Array) { 16 | assert.strictEqual(obj.__proto__, proto) 17 | } else { 18 | assert.strictEqual(obj.a, 1) 19 | assert.strictEqual(obj.b, 2) 20 | assert.strictEqual(obj.c, 4) 21 | } 22 | assert.strictEqual(mergeObj, obj) 23 | }) 24 | }) 25 | -------------------------------------------------------------------------------- /javascript_postgres/asyncFullTable.js: -------------------------------------------------------------------------------- 1 | const {Client} = require('pg') 2 | const client = new Client({ 3 | user: "postgres", 4 | password: "postgres", 5 | host: "husseinmac", 6 | port: 5432, 7 | database: "husseindb" 8 | }) 9 | 10 | execute() 11 | 12 | async function execute() { 13 | try{ 14 | 15 | await client.connect() 16 | console.log("Connected successfully.") 17 | //await client.query("insert into employees values (1, 'John')") 18 | 19 | const {rows} = await client.query("select * from employees") 20 | console.table(rows) 21 | 22 | } 23 | catch (ex) 24 | { 25 | console.log(`Something wrong happend ${ex}`) 26 | } 27 | finally 28 | { 29 | await client.end() 30 | console.log("Client disconnected successfully.") 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /docker/app/node_modules/inherits/LICENSE: -------------------------------------------------------------------------------- 1 | The ISC License 2 | 3 | Copyright (c) Isaac Z. Schlueter 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 | PERFORMANCE OF THIS SOFTWARE. 16 | 17 | --------------------------------------------------------------------------------