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
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
peterforgacs / README.md
Last active Feb 3, 2018
[Koa routing] How to pipe koa steps and routers #koa #koarouter #node.js #javascript
View README.md

Koa

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
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) {
console.log(res.result());
});
View bootstrap-tab-panel-example.markdown
@peterforgacs
peterforgacs / Windows10AWSEC2.md
Last active Jun 21, 2019
Running Windows 10 on AWS EC2
View Windows10AWSEC2.md

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

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

@peterforgacs
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
Comment=
Exec=/usr/bin/google-chrome-stable %U
Icon=/opt/google/chrome/product_logo_64.png
StartupWMClass=google-chrome
Terminal=false
Type=Application
Categories=Internet
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;x-scheme-handler/https;x-scheme-handler/http;text/html;
@peterforgacs
peterforgacs / readme.md
Last active Dec 30, 2016
getting tracks from webrtc stream to record
View readme.md

You can extract audio tracks from a media stream.

You can’t perform that action at this time.