Skip to content

Instantly share code, notes, and snippets.

View lavir's full-sized avatar

Alex Lukyanov lavir

  • ContractMill
  • Finland
View GitHub Profile
@dannberg
dannberg / obsidian-daily-note-template.txt
Last active May 1, 2024 12:56
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[Timestamps/<% tp.date.now("YYYY", -1) %>/<% tp.date.now("MM-MMMM", -1) %>/<% tp.date.now("YYYY-MM-DD-dddd", -1) %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1) %>/<% tp.date.now("MM-MMMM", 1) %>/<% tp.date.now("YYYY-MM-DD-dddd", 1) %>|Tomorrow]] >>
---
@sindresorhus
sindresorhus / esm-package.md
Last active May 1, 2024 07:18
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@eklex
eklex / 80-mount-usb-to-media-by-label.rules
Last active April 16, 2024 18:49
udev rule for Home Assistant OS (hassio) to mount USB drives into the Supervisor Media directory
#
# udev rule
# Mount USB drive to the media directory using the partition name as mount point
#
# Description:
# Created for Home Assistant OS, this rule mounts any USB drives
# into the Hassio media directory (/mnt/data/supervisor/media).
# When a USB drive is connected to the board, the rule creates one directory
# per partition under the media directory. The newly created partition is named
# as the partition name. If the partition does not have a name, then the following
@58bits
58bits / multipart.js
Created August 15, 2020 02:02
MultiPart Handler
'use strict'
const config = require('../../config')
const { MultipartError } = require('./errors')
const fs = require('fs')
const path = require('path')
const nanoid = require('nanoid')
const Multipart = (request, response, done) => {
// Note: onFile and addToBody cannot be handled on a per reuqest basis at the moment

Это краткая памятка, которая подходит во время вспышки любого респираторного вирусного заболевания. Я ее пишу не для того, чтобы вы срочно начинали все это делать - никакого повода нет. Но, если вы хотите снизить вероятность получения или распространения вирусов - прочитайте.

Общее поведение

  1. Контролируйте свою панику. Никакого повода для паники нет, как говорил человек, падающий с пятого этажа, пролетая мимо четвертого: “пока все нормально”. Напомню, уже на вашей памяти у людей была такая же паника из-за птичьего гриппа и атипичной пневмонии. И никакого зомби-апокалипсиса не произошло. Контролировать панику - значит следить за своими реакциями и стараться принимать решения разумно.
  2. Не осуждайте чужую панику. Это не помогает ни вам, ни паникующим - каждый человек волен паниковать или не паниковать перед лицом любой опасности. Кроме того, активное осуждение паники вокруг “эпидемий” порождает и подпитывает многочисленные теории заговора, так что просто не надо.
  3. Примите разумные меры предосторожно
// time and time end
console.time("This");
let total = 0;
for (let j = 0; j < 10000; j++) {
total += j
}
console.log("Result", total);
console.timeEnd("This");
// Memory
@arcdev1
arcdev1 / use-ck-editor.js
Last active March 10, 2023 16:33
A custom React Hook for using CKEditor with SSR particularly with NextJS. https://ckeditor.com | https://nextjs.org
// A custom React Hook for using CKEditor with SSR
// particularly with NextJS.
// https://ckeditor.com | https://nextjs.org
import React, { useRef, useState, useEffect } from 'react'
export default function useCKEditor () {
const editorRef = useRef()
const [isEditorLoaded, setIsEditorLoaded] = useState(false)
const { CKEditor, InlineEditor } = editorRef.current || {}
@threepointone
threepointone / for-snook.md
Last active August 26, 2023 15:43
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

@pamolloy
pamolloy / README.md
Last active January 23, 2024 07:28
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from https://github.com/Lochnair/vyatta-wireguard/releases and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key

VPN-сервисы

Существует огромное количество VPN-сервисов. Вот два популярных варианта:

  1. https://nordvpn.com/ большие скидки при оплате за 2 и 3 года, возврат денег в течение 30 дней (если зайти на https://nordvpn.com/features/ и пролистать вниз, то появится попап со скидкой 77% — $99 за три года)
  2. https://www.privateinternetaccess.com/ старый, добротный

Таблица сравнения кучи VPN-сервисов https://thatoneprivacysite.net/vpn-comparison-chart/

См. также: