- Comment out the line with
load-module module-role-cork
in/etc/pulse/default.pa
- Reboot OS
Run in shell
#!/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 |
zfs list -t snapshot -r | grep auto | cut -f1 -d' ' | xargs -n 1 sudo zfs destroy |
/* | |
каждые 250 мс нам поступает асинхронно новая запись которая дописывается во входящий буфер | |
процедура записи извлекает элементы с начала буфера и записывает в лог файл. | |
процедура записи обернута в debounce | |
если данные не поступают 500 мс или более то происходит запись данных в лог файл | |
также принудительно после 1000 мс так же происходит запись в лог файл |
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 => { |
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() |
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') |
- 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 |
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> { |
import fs from 'fs' | |
import http from 'http' | |
import { basename } from 'path' | |
import { URL } from 'url' | |
const TIMEOUT = 10000 | |
export default function (url, path) { | |
const uri = new URL(url) | |
if (!path) { |