Skip to content

Instantly share code, notes, and snippets.

const https = require('https')
/*
const argv = require('yargs')
.option('token', {
alias: 't',
describe: 'api token',
demand: true,
type: 'string',
})

Keybase proof

I hereby claim:

  • I am ilyaigpetrov on github.
  • I am ilyaigpetrov (https://keybase.io/ilyaigpetrov) on keybase.
  • I have a public key whose fingerprint is 7EF4 ED7C 6C9E 54A5 F1FE 74F0 B7E2 70A4 199F 1EC2

To claim this, I am signing this object:

Kodi On Raspian On RPI0 Issues

This document is a part of RPI0 review: https://git.io/ilyaigpetrov-rpi0.

$ kodi-standalone --version
18.2 Git:20190428-a94ccc8ba5 Media Center Kodi
Copyright (C) 2005-2018 Team Kodi - http://kodi.tv
$ lsb_release -a
No LSB modules are available.
@ilyaigpetrov
ilyaigpetrov / Gentoo Xorg Config For Two Layouts.sh-session
Last active January 26, 2020 14:54
Gentoo Xorg Config For Two Layouts on Gentoo | by https://git.io/ilyaigpetrov
# File: /etc/X11/xorg.conf.d/30-keyboard.conf
Section "InputClass"
Identifier "keyboard-all"
Driver "evdev"
Option "XkbLayout" "us,ru"
Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll,compose:rwin,terminate:ctrl_alt_bksp"
MatchIsKeyboard "on"
EndSection
@ilyaigpetrov
ilyaigpetrov / _0_Hosting Simple Static Site on Appengine Standard for Free.md
Last active January 26, 2020 14:54
Hosting Simple Static Site on Appengine Standard for Free | by https://git.io/ilyaigpetrov

Hosting Simple Static Site on Appengine Standard for Free

This set of files is all you need to host a static web site on Google Appengine Standard for free.

@ilyaigpetrov
ilyaigpetrov / request-kitchen.md
Last active January 26, 2020 14:55
Request Kitchen Extension For FireFox And Chromium | https://github.com/ilyaigpetrov/request-kitchen | by https://git.io/ilyaigpetrov

Request Kitchen

Extension for handling requests according to lists added by user (e.g. lists may be hosted on github, npm -- any url will work. Maybe there even will be a special support for popular tabular data editors like google docs/spreadsheets).

The internal workings of the extension are based on PAC scripts.

You just click a specially formed url (e.g. request-kitchen.appspot.com/add-list=https://raw.github.com/foo/bar)

and extension hijacks your click and shows user a big WARNING page, e.g. "You are about to conceive a child by installing this list named 'POOP' which purpose is 'Throw some poops in your browser'. Are you sure?"

@ilyaigpetrov
ilyaigpetrov / matrix-js-peek-into-room.js
Last active January 26, 2020 14:55
matrix-js-peek-into-room.js | by https://git.io/ilyaigpetrov
'use strict';
(async function() {
const apiPrefix = 'https://matrix.org'
let access_token;
const myFetch = (url, { query, params } = { query: '&', params: {} }) => {

Ways of Handling Rejected Promises in JavaScript

This note/example shows 3 different ways of handling promise rejections in JavaScript.

Before we start you may want to refresh in your mind that:

  1. .then(...) takes two arguments: MDN.
  2. .catch(...) is a syntactic surgar around .then(...) with two arguments: MDN.
  3. Exploring JS:

    Exceptions that are thrown in the callbacks of then() and catch() are passed on to the next error handler, as rejections

@ilyaigpetrov
ilyaigpetrov / configure-hapi-style-guide.markdown
Last active January 26, 2020 14:56
How to Configure Hapi Style Guide | by https://git.io/ilyaigpetrov

Short link: https://git.io/hapi-style

How to Configure Hapi Style Guide

npm install --save-dev eslint
npm install --save-dev eslint-plugin-hapi
npm install --save-dev eslint-config-hapi
vim .eslintrc.json
{
$ time node --expose-gc --trace-gc --trace-gc-verbose for-nodejs.js 13231
[1776:0x3153a50] Heap growing factor 4.0 based on mu=0.970, speed_ratio=-nan (gc=0, mutator=0)
[1776:0x3153a50] Grow: old size: 3897 KB, new limit: 16598 KB (4.0)
[1776:0x3153a50] 145 ms: Mark-sweep 4.7 (10.8) -> 4.3 (11.8) MB, 11.6 / 0.0 ms Isolate::RequestGarbageCollection GC in old space requested
[1776:0x3153a50] Memory allocator, used: 12068 KB, available: 1454300 KB
[1776:0x3153a50] New space, used: 534 KB, available: 473 KB, committed: 2048 KB
[1776:0x3153a50] Old space, used: 1219 KB, available: 0 KB, committed: 1944 KB
[1776:0x3153a50] Code space, used: 738 KB, available: 0 KB, committed: 2048 KB
[1776:0x3153a50] Map space, used: 131 KB, available: 0 KB, committed: 1108 KB
[1776:0x3153a50] Large object space, used: 1807 KB, available: 1453259 KB, committed: 1848 KB