Skip to content

Instantly share code, notes, and snippets.

@ilyaigpetrov
ilyaigpetrov / why-my-tk-site-was-deleted-by-freenom.md
Last active July 20, 2023 02:46
Why My .tk Site Was Deleted by Freenom? | by https://git.io/ilyaigpetrov

Permanent link: https://git.io/why-my-tk-site-was-deleted

UPD: Now (October of 2018) Freenom informs you a few days before deleting your site. Thank you, Freenom!

My .tk Site Was Deleted by Freenom

I sustained a site anticensority.tk registered by Freenom.
Site/domain was heavily used but had almost no HTML content.
It also was behind Cloudflare servers for better caching.

// It doesn't work well, I just want to save this imperfect note for myself in case I need it in the future.
// It's a modified version of code on https://stackoverflow.com/a/43900205/521957
// If want to know how http2 session is initiated also look at https://github.com/golang/net/blob/master/http2/transport.go#L532
package main
import (
"crypto/tls"
"io"
"log"
"os"
@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
{
const https = require('https')
/*
const argv = require('yargs')
.option('token', {
alias: 't',
describe: 'api token',
demand: true,
type: 'string',
})

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 / 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: {} }) => {
@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?"

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:

@ilyaigpetrov
ilyaigpetrov / Evaluate the Risk of Browser Extension Before Installing It by Reading the Source Code.md
Last active March 29, 2024 19:30
Evaluate the Risk of Browser Extension Before Installing It by Reading the Source Code | by https://git.io/ilyaigpetrov

Evaluate the Risk of Browser Extension Before Installing It by Reading the Source Code

This post is written for Manifest v2, Manifest v3 is not yet released at the moment.

Ok, kids, today we are going to scrutinize a source code of a browser extension to speculate about its risks.
First, you will need to know how to download or view browser extension source codes:

  1. Extension for Chromium/Chrome: https://chrome.google.com/webstore/detail/chrome-extension-source-v/jifpbeccnghkjeaalbbjmodiffmgedin
  2. Right Click for FireFox: https://superuser.com/questions/771825/how-to-examine-source-code-of-firefox-extension-before-installing-it
@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.