Node JS Socket.IO

//—————- HTTPS Server —————————————- var fs = require(‘fs’); var https = require(‘https’); var express = require(‘express’); var app = express(); var options = { key: fs.readFileSync(‘/etc/letsencrypt/live/hg-system.com/privkey.pem’), cert: fs.readFileSync(‘/etc/letsencrypt/live/hg-system.com/fullchain.pem’) }; var server = https.createServer(options, app); var port = 3000; server.listen(port, function() { log(‘listening on *:’ + port); }); app.use(express.static(‘public’)); app.get(‘/’, (req, res) => { res.sendFile(‘index.html’); }); Weiterlesen…

NodeJS DB Connection

//—————- SQL Server —————————————- var mysql = require(‘mysql’); var db = mysql.createConnection({ host : ‘localhost’, user : ‘dbuser’, password : ‘dbpass’, database: ‘dbname’ }); db.connect(); db.query(‘SELECT 1 + 1 AS solution‘, function(err, rows, fields) { if (err) throw err; console.log(‘The solution is: ‘, rows[0].solution); }); process.on(‘exit’, function (){ db.end(); console.log(‘Goodbye!’); });

NodeJS HTTP/HTTPS – Server (with Let’s Encrypt SSL Cert)

Basic HTTP-Server var fs = require(‘fs’); var http = require(‘http’); var express = require(‘express’); var app = express(); var server = http.createServer(app); var port = 3000; server.listen(port, function() { log(‘listening on *:’ + port); }); app.use(express.static(‘public’)); app.get(‘/’, (req, res) => { res.sendFile(‘index.html’); }); Extend your Server to HTTPS with Free SSL Cert var fs = Weiterlesen…

SSL Wildcard *.example.com

SSL Wildcard CERT: sudo apt install certbot   certbot certonly –manual –preferred-challenges dns –server https://acme-v02.api.letsencrypt.org/directory –manual-public-ip-logging-ok -d ‘*.hg-system.com’   Go to your DNS Provider for e.g. Cloudflare insert the txt record “_acme-challenge” insert the code from the command ahead, wait for at least 2 min or till the DNS-Record is available and press enter (in Weiterlesen…

Lets Encrypt ACME Challenge for Wildcard Certificate

You need access to the DNS and be able to create txt records. certbot certonly –manual –preferred-challenges dns –server https://acme-v02.api.letsencrypt.org/directory –manual-public-ip-logging-ok -d ‘*.hg-system.com’ -d hg-system.com Change hg-system.com to your Domain Name… Create the txt Record in your DNS. Type TXT Name _acme-challenge Value the command shows above Note that you need to change the acme Weiterlesen…

Solve GTA5 error 7002.1

GTA5 Error 7002.1 and why it happend. The Protected Folder Access is supposed to block crypto Trojans that want to encrypt the hard drive and limit the damage here. Since the Social Club accesses its own files at: %userprofile%\OneDrive\Dokumente\Rockstar Games\Launcher\, access is blocked here. To some extent To prevent errors such as the capture at Weiterlesen…

Linux Shell Scripts

#!/bin/bash url=$1 && file=”${url##*/}” && wget $url && extension=”${url##*.}” && echo -e “\n\n” if [ $extension = ‘js’ ] then echo -e “Generate JS HTML output\n” echo -ne “<script type=\”text/javascript\” src=\”$url\” integrity=\”sha256-” && echo -ne openssl dgst -sha256 -binary url | openssl base64 -A && echo -e “\” crossorigin=\”anonymous\”></script>\n\n” elif [ $extension = ‘css’ ] Weiterlesen…