Skip to content

Instantly share code, notes, and snippets.

View tinovyatkin's full-sized avatar
💭
I may be slow to respond.

Konstantin Vyatkin tinovyatkin

💭
I may be slow to respond.
View GitHub Profile
@tinovyatkin
tinovyatkin / getAllImports.ts
Last active December 3, 2023 11:40
Getting all imported modules names from a JS file using TypeScript parser
import { readFileSync } from 'fs';
import { builtinModules } from 'module';
import ts from 'typescript';
const tsHost = ts.createCompilerHost(
{
allowJs: true,
noEmit: true,
isolatedModules: true,
@tinovyatkin
tinovyatkin / amz_linux_git.md
Created November 13, 2023 16:54 — forked from rjhintz/amz_linux_git.md
AWS Linux: Git Install From Source

AWS Linux: Installing Git from Source

Method

Method:

  1. sudo yum update
  2. sudo yum install curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel
  3. sudo yum install asciidoc xmlto docbook2X
  4. sudo yum install gcc autoconf
  5. sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
  6. wget https://github.com/git/git/archive/v2.8.4.zip
"""
Reorder site-packages ahead of Extras and lib-dynload.
Two implementations:
1. puts site-packages ahead of stdlib (technically hazardous,
but not really an issue).
2. is more conservative, only demoting Extras below site-packages.
Add this to ~/Library/Python/2.7/lib/python/site-packages/sitecustomize.py
"""
#!/bin/bash
sudo yum install gcc -y
sudo yum install openssl-devel -y
sudo yum install zlib-devel -y
sudo yum install mlocate -y
sudo yum install autoconf -y
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz
tar zxvf openssh-9.1p1.tar.gz
cd openssh-9.1p1
./configure --prefix=/usr
@tinovyatkin
tinovyatkin / webpack-https-mkcert.md
Last active August 17, 2023 11:42 — forked from Grawl/webpack-https-mkcert.md
Running Webpack Dev Server with HTTPS on developer machine using MKCERT
  1. Add local domain to /etc/hosts:

    127.0.0.1 my-project.dev

  2. Install mkcert

  3. Create certificate for this domain:

    ➜ mkcert my-project.dev
@tinovyatkin
tinovyatkin / lambda.ts
Last active July 27, 2023 11:13 — forked from streamich/lambda.js
using node-postgres (`pg`) in AWS Lambda
import type { Handler } from "aws-lambda";
import { Pool } from "pg";
// connection details inherited from environment
const pool = new Pool({
max: 1,
min: 0,
idleTimeoutMillis: 120000,
connectionTimeoutMillis: 10000
});
{
"type": "object",
"required": ["Statement"],
"additionalProperties": false,
"properties": {
"Version": {
"type": "string",
"enum": ["2008-10-17", "2012-10-17"]
},
"Id": {
@tinovyatkin
tinovyatkin / action.yml
Created September 27, 2019 08:54
Install Node.JS version pinned at `engines` in `package.json` on GitHub Actions Workflow
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
@tinovyatkin
tinovyatkin / loadFont.js
Last active November 17, 2022 23:09
My function to async load web fonts (real WOFF and WOFF2, not base64 behemots), cache them to localStorage and reuse on next visits
/**
* This function load font from web, stores it in localStorage and reuses on next page loads
* Different to everything I found on the internet due to following facts
* 1. Checks if the font is installed in the system and spend no time if it is
* 2. Loads actual WOFF or WOFF2 fonts (if supported) and not bit base64 encoded version - so it faster
* 3. Uses fetch API and FontFace API if available - it's cool!
* 4. Return promises and uses jQuery for cases where native promises probably not available
*
* @param fontName (Field for font-face)
* @param fontUrl (full URL but without .woff nor .woff2 extensions - format will be selected automatically)
@tinovyatkin
tinovyatkin / passkit-webservice-swagger.json
Created December 9, 2019 12:40 — forked from ckrack/passkit-webservice-swagger.json
Passkit Webservice Swagger for Apple Wallet Webservice
{
"swagger": "2.0",
"info": {
"title": "Passkit Web Service",
"contact": {
"name": "Clemens Krack",
"email": "info@clemenskrack.com"
},
"version": "1.0.0"
},