Skip to content

Instantly share code, notes, and snippets.

View jbutko's full-sized avatar

Jozef Butko jbutko

View GitHub Profile
@jbutko
jbutko / auto-restart-unix-service-mongod.md
Last active June 7, 2021 08:27
Auto restart system service (mongod) on crash
  1. Create bash script file, eg. nano /opt/scripts/reload-service.sh, add these commands in the file:
#!/bin/bash

NOW=$(date +"%d.%m.%Y_-_%H:%M:%S")

systemctl -q is-active mongod.service || \
echo "$NOW Mongod service down, restarting..." \
sudo service mongod restart
@jbutko
jbutko / chrome-dev-tools-snippets.md
Created March 12, 2021 07:43
Chrome dev tools snippets

search for multiple file types in network tab, put into search bar:

/.*png|jpg|webp+$/
@jbutko
jbutko / convert-images-to-webp.md
Created March 11, 2021 13:41
Convert png/jpg files to webp
@jbutko
jbutko / loop-promises-in-sequence.md
Created March 10, 2021 09:31
Loop promises in sequence (serially)
@jbutko
jbutko / start-stop-mongodb.md
Created February 2, 2021 09:33
Start or stop mongodb service on windows

Start: net start MongoDB

Stop: net stop MongoDB

@jbutko
jbutko / how-to-upgrade-cra.md
Last active January 26, 2021 07:36
How to update Create react app application

To get available versions:

npm view react-scripts versions --json

npm view react versions --json

npm view react-dom versions --json

and then upgrade:

@jbutko
jbutko / ga.ts
Created December 22, 2020 15:58
Google Analytics: React util (react-ga)
import ReactGA, { InitializeOptions, EventArgs } from 'react-ga';
const gaOptsDefault = {
debug: true,
siteSpeedSampleRate: 100,
};
export const GA_ID = 'G-XXXXXXXXXXX';
export const GA_EVENTS = {
@jbutko
jbutko / upgrade-yarn-packages.md
Created March 30, 2020 08:54
Upgrade yarn/npm packages interactively

yarn upgrade-interactive --latest

@jbutko
jbutko / handle-file-download-react-axios.js
Last active September 19, 2024 14:28
React, JS, Axios: Download blob file (PDF...)
import axios, { AxiosResponse } from 'axios';
import { get } from 'lodash-es';
const rest = axios.create({
baseURL: 'some base URL goes here',
});
// this one send file as Blob type
const getPdf = () => (
rest.get(`/get-pdf`, {