Skip to content

Instantly share code, notes, and snippets.

View tfsoares's full-sized avatar

Tiago Filipe Soares tfsoares

  • craftablesoftware
  • Aveiro
View GitHub Profile
@tfsoares
tfsoares / repl.js
Created August 21, 2021 15:52
REPL ElasticMQ message producer
const repl = require('repl');
const http = require('http');
let currentQueueHost = 'localhost';
let currentQueuePort = '9324';
let message;
function myWriter(output) {
return output;
}
@tfsoares
tfsoares / promisify.js
Last active September 27, 2018 16:42
[Javascript bits]
function (method) {
return function () {
const callerArgs = arguments;
return new Promise((res, rej) => {
method.apply(null, [...callerArgs, function (err, data) {
if (err) rej(err);
else res(data);
}])
});
}
@tfsoares
tfsoares / README.md
Last active September 14, 2017 12:55
run remote Ubuntu Desktop Environment

Run remote Ubuntu Desktop Environment

$ apt-get update && apt-get install -y xserver-xorg-video-dummy x11vnc ubuntu-gnome-desktop lightdm

$ nano /etc/X11/xorg.conf

$ x11vnc -storepasswd

$ nano /etc/systemd/system/x11vnc.service

@tfsoares
tfsoares / Presto.md
Created January 14, 2016 16:14
Presto SQL snippets

Presto SQL

Just some snippets about Presto SQL.

Force x amount of digits on a number

SELECT REVERSE(SUBSTR(REVERSE([number as varchar]) || [(x-1) * '0'], 1, x))
// ==UserScript==
// @name Kibana
// @version 0.7.1
// @description Kibana Log Context view helper
// @grant GM_getValue
// @grant GM_setValue
// @author tsoares
// @match http://*/kibana/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==