Skip to content

Instantly share code, notes, and snippets.

Peter Forgacs peterforgacs

Block or report user

Report or block peterforgacs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
peterforgacs / index.js
Last active Feb 10, 2018
[base64 string to image file] How to write an image in node.js #Node.js
View index.js
'use strict';
const util = require('util');
const fs = require('fs');
const write = util.promisify(fs.writeFile);
module.exports = ({ image, identifier, directory }) => {
try {
const extension = image.split(';')[0].match(/jpeg|png|gif/)[0];
const data = image.replace(/^data:image\/\w+;base64,/, '');
peterforgacs /
Last active Feb 3, 2018
[Koa routing] How to pipe koa steps and routers #koa #koarouter #node.js #javascript


Uses middleware pattern.
Each time we use app.use we add an other middleware function.

ctx - The context contains all the information for a signle request and the response object aswell.

next - Calls the next middleware.

peterforgacs / stats.js
Last active Jan 19, 2018
Peer connection RTCLegacyStatsReport
View stats.js
// Chrome 63
let peerConnectionObject = ... // Some peer connection
peerConnectionObject.getStats(function(res) {
View bootstrap-tab-panel-example.markdown
peterforgacs /
Last active Sep 18, 2019
Running Windows 10 on AWS EC2

Running Windows 10 on AWS EC2

Downloading the image

Download the windows image you want.

AWS vmimport supported versions: Microsoft Windows 10 (Professional, Enterprise, Education) (US English) (64-bit only)

So Home wont work.

peterforgacs /
Created Dec 30, 2016
Wait for a process to exit to run a command
# Wait for firefox to be closed
while [ `pidof firefox` ]
wait `pidof firefox`
# do something after ff exited
peterforgacs /
Last active Jan 29, 2017
Controlling screen brigthness with ubuntu
xrandr --current --verbose | grep -i "Brightness:*" | grep -io -m 1 [[:digit:]].[[:digit:]]
peterforgacs /
Last active Dec 30, 2016
Download a youtube playlist starting from a certain item with numbering

You can add a paylist link. You can specify start episode number. Give special naming rules.

peterforgacs / google-chrome.desktop
Last active Dec 30, 2016
Ubunutu 16.04 Gnome Chrome Launcher desktop file
View google-chrome.desktop
[Desktop Entry]
Name=Google Chrome
Exec=/usr/bin/google-chrome-stable %U
peterforgacs /
Last active Dec 30, 2016
getting tracks from webrtc stream to record

You can extract audio tracks from a media stream.

You can’t perform that action at this time.