CTRL + A
: Move the cursor to the beginning of the line
CTRL + E
: Move the cursor to the end of the line
OPTION + Left Arrow
: Move the cursor one word backward
OPTION + Right arrow
: Move the cursor one word forward
Left Arrow
: Move the cursor one character backward
Right Arrow
: Move the cursor one character forward
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Removes old revisions of snaps | |
# CLOSE ALL SNAPS BEFORE RUNNING THIS | |
set -eu | |
snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; do | |
snap remove "$snapname" --revision="$revision" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zfs list -t snapshot -r | grep auto | cut -f1 -d' ' | xargs -n 1 sudo zfs destroy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
каждые 250 мс нам поступает асинхронно новая запись которая дописывается во входящий буфер | |
процедура записи извлекает элементы с начала буфера и записывает в лог файл. | |
процедура записи обернута в debounce | |
если данные не поступают 500 мс или более то происходит запись данных в лог файл | |
также принудительно после 1000 мс так же происходит запись в лог файл |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const got = require('got'); | |
const stream = require('stream'); | |
const fs = require('fs'); | |
const { promisify } = require('util'); | |
const pipeline = promisify(stream.pipeline); | |
// instantiate the download stream - use options to set authorization header etc. if needed | |
let downStream = got.stream('https://example.com/download'); | |
downStream.on('response', response => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express' | |
import pino from 'pino' | |
import pinoHttp from 'pino-http' | |
import { SERVICE_UNAVAILABLE } from 'http-status' | |
// import { db } from './db' | |
const logger = pino({ level: process.env.LOG_LEVEL || 'info' }) | |
const PORT = process.env.PORT || 3000 | |
const app = express() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
console.time('hash') | |
const hash = crypto.createHash('md5').update(str).digest("hex"); | |
console.timeEnd('hash') | |
console.log(hash) | |
// sha1 function is much faster on my computer | |
console.time('hash2') | |
const hash2 = crypto.createHash('sha1').update(str).digest("base64"); | |
console.timeEnd('hash2') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- read the "performant programmer" book | |
- special ergonomic keyboard | |
- good hardware & fast CPU | |
- Pomidoro technic | |
- Rubber duck technic | |
- Remote debugger | |
- Ultra wide screen or additional screens | |
- JetBrains + Shortcuts + Key Promoter + Plugins | |
- Shell with multiple windows on hotkey | |
- Oh my Zh with plugins + aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
import https from 'https' | |
import http from 'http' | |
import { basename } from 'path' | |
import { URL } from 'url' | |
const TIMEOUT = 10000 | |
const MAX_DOWNLOAD_FILE_SIZE = 1024 * 1024 * 200 // 200MB | |
export function downloadAsBuffer (url: string): Promise<Buffer> { |
NewerOlder