Skip to content

Instantly share code, notes, and snippets.

View EddieCanales's full-sized avatar

Eddie Canales EddieCanales

View GitHub Profile
@EddieCanales
EddieCanales / rdp.js
Last active April 30, 2019 05:11
How to get screenshots when using node-rdpjs. Write the partial bitmap and render it into the right section of the "buffer" image, then save that to disk whenever you need to.
const screen = require('./screen');
const SCREEN_SIZE = { width : 1364, height : 768 };
async function saveScreen(label) {
await screen.write('screen-'+Date.now()+'-'+(label || '')+'.png');
}
async function createRemoteSession(userName, password, server, rdpScreenSaveInterval=0) {
const clientConfig = {
autoLogin: true,
@EddieCanales
EddieCanales / google-analytics-exception-tracking.js
Created May 21, 2020 01:59
Record client-side exceptions in Google Analytics
import ga from 'universal-ga';
window.addEventListener('error', e => {
let message;
if (e.error && e.error.stack) {
message = e.error.stack;
} else {
message = e.error || e.message || 'Unknown error';
}