Skip to content

Instantly share code, notes, and snippets.

View marceliwac's full-sized avatar
🔥
Fighting entropy since 97'

Marceli Wac marceliwac

🔥
Fighting entropy since 97'
View GitHub Profile
@marceliwac
marceliwac / useLatestDataBug.jsx
Created September 2, 2020 16:20
The useLatestData hook with a bug that does not take into account updated path.
import React from 'react';
import {api} from '../data/store.js';
import config from "../config/config";
import ConnectionContext from "../contexts/ConnectionContext";
const Logger = require('@marceliwac/logger');
const refreshInterval = (1000 * config.dataRefreshIntervalInSeconds) || 10000;
async function newDataAvailable(checksumPath, currentChecksum){
@marceliwac
marceliwac / useLatestDataTempFix.jsx
Last active September 6, 2020 12:24
Temporarily-fixed useLatestData that uses useEffect hook to detect change in path.
import React from 'react';
import {api} from '../data/store.js';
import config from "../config/config";
import ConnectionContext from "../contexts/ConnectionContext";
const Logger = require('@marceliwac/logger');
const refreshInterval = (1000 * config.dataRefreshIntervalInSeconds) || 10000;
async function newDataAvailable(checksumPath){
@marceliwac
marceliwac / signalMeter.sh
Created July 9, 2019 13:04
MacOS WiFi signal-strength meter
#!/bin/bash
#
# Authored by: Marceli Wac
#
# MacOS utility used for displaying the signal strength in a form of cascading progress bar
# prepended with a percentage value. Signal strength is expressed using cubic formula for
# conversion between dBm and % as described in http://cecas.clemson.edu/linux/nm-ipw2200.shtml
# Progress bar should be used for indication only.
# Uncertainty progress bar: +/- 2%
# percentage value: +/- 1%