Skip to content

Instantly share code, notes, and snippets.

View vildzi's full-sized avatar
😀

Vilius vildzi

😀
  • 15:13 (UTC -07:00)
View GitHub Profile
apt-get update
apt-get install nginx npm software-properties-common
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install certbot python-certbot-apache
npm i -g pm2
pm2 startup
echo "Done, you can modify nginx config in /etc/nginx/sites-available/default and add certs using certbot -d <domain>"

Keybase proof

I hereby claim:

  • I am vilp1l on github.
  • I am vilp1l (https://keybase.io/vilp1l) on keybase.
  • I have a public key ASC2NvWzx5qwxCvZ-Qr3boK8GshNmnF4n0l2Cd4y_Yv6bAo

To claim this, I am signing this object:

@vildzi
vildzi / HQWebSocket.js
Created March 22, 2019 21:41
HQ Trivia websocket tutorial
const request = require('request'); // npm i request
const WebSocket = require('ws'); // npm i ws
request('https://api-quiz.hype.space/shows/now`, (err, res, body) => {
const json = JSON.parse(body);
if (json.active) {
const ws = new WebSocket(json.broadcast.socketUrl, { headers: { authorization: '<BEARER TOKEN>' } });
ws.onopen = () => {
const i = setInterval(() => {
if (ws.readyState !== ws.OPEN) return clearInterval(i);