Skip to content

Instantly share code, notes, and snippets.

@keepitsimple
keepitsimple / download.js
Last active March 6, 2021 15:33 — forked from falkolab/download.js
Download file by http with progress (ES6, promises, NodeJS 12.x)
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) {
@keepitsimple
keepitsimple / bitbucket-pipelines.yml
Last active August 26, 2024 00:06
Bitbucket pipeline to sync / copy code commits to GitHub. How to sync Bitbucket repo to GitHub
image: alpine/git:1.0.26
definitions:
services:
docker:
memory: 1024
steps:
- step: &Push-to-GitHub
name: Push code changes to GitHub
@keepitsimple
keepitsimple / gist:43d1a7f91566703b597ee536004a7e4c
Created October 9, 2020 13:25
Clean unused docker objects
docker system prune --filter "until=24h"
@keepitsimple
keepitsimple / trace-react-rerendering.md
Last active June 4, 2020 14:02
Trace why a React component is re-rendering
const path = require('path')
module.exports = {
eslint: {
enable: false
},
webpack: {
alias: {
src: path.resolve(__dirname, 'src/')
},
const path = require('path')
module.exports = {
extends: [
'react-app',
'standard',
'standard-react',
'plugin:import/errors',
'plugin:import/warnings'
],
@keepitsimple
keepitsimple / gist:d112615ccb620569c151201e85217791
Last active January 10, 2022 12:30
Docker-compose: create mongo dump as local archive and restore MongoDB from archive
# Make mongodb backup as gzipped archive -T very important if you use docker-compose
docker-compose exec -T [mongo service name] mongodump --db=[dbname] --gzip --archive|cat >dump_$(date '+%d-%m-%Y_%H-%M-%S').gz
#Restore mongodb from gzipped archive
docker-compose exec -T mongo mongorestore --archive --gzip < dump_xxx.gz
@keepitsimple
keepitsimple / index.html
Created April 16, 2020 12:58 — forked from kkm/index.html
Chrome MediaRecorder in H264
<!DOCTYPE html>
<head>
<script>
var recordedChunks = [];
var constraints = {
audio: true,
video: true
};
var mediaRecorder = null;
@keepitsimple
keepitsimple / gist:2fbd4875e70114db599a3c1eed78982b
Created January 29, 2020 15:20
PostgreSQL connections count
select max_conn,used,res_for_super,max_conn-used-res_for_super res_for_normal
from
(select count(*) used from pg_stat_activity) t1,
(select setting::int res_for_super from pg_settings where name=$$superuser_reserved_connections$$) t2,
(select setting::int max_conn from pg_settings where name=$$max_connections$$) t3;
select * from pg_stat_activity;
@keepitsimple
keepitsimple / piterjs_conf_irustm.md
Created January 18, 2020 20:08 — forked from irustm/piterjs_conf_irustm.md
Прототипы приложений на современных технологиях