-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed 6 months of cruft
- Loading branch information
0 parents
commit 027a247
Showing
71 changed files
with
27,462 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# MacOS | ||
.DS_Store | ||
|
||
release-builds/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
CC0 1.0 Universal | ||
================== | ||
|
||
Statement of Purpose | ||
--------------------- | ||
|
||
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). | ||
|
||
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. | ||
|
||
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. | ||
|
||
1. Copyright and Related Rights. | ||
-------------------------------- | ||
A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: | ||
|
||
i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; | ||
ii. moral rights retained by the original author(s) and/or performer(s); | ||
iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; | ||
iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; | ||
v. rights protecting the extraction, dissemination, use and reuse of data in a Work; | ||
vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and | ||
vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. | ||
|
||
2. Waiver. | ||
----------- | ||
To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. | ||
|
||
3. Public License Fallback. | ||
---------------------------- | ||
Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. | ||
|
||
4. Limitations and Disclaimers. | ||
-------------------------------- | ||
|
||
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. | ||
b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. | ||
c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. | ||
d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Pandemic Pulse | ||
|
||
**Pandemic Pulse** infects your computer's resources at the rate of COVID-19 infections and deaths in your location. It exhausts your CPU power at the rate of local infections and lowers your screen’s brightness at the rate of local COVID-19- related deaths. | ||
|
||
## Table of Contents | ||
|
||
- [Background](#background) | ||
- [Usage](#usage) | ||
- [Acknowledgments](#acknowledgments) | ||
- [Disclaimer](#disclaimer) | ||
|
||
## Background | ||
|
||
Since the World Health Organization declared COVID-19 an international health emergency on January 30, 2020, the virus has dominated the news. The pandemic has profoundly shaped our “new normal”-- forcing us to socially distance and wear masks to stay safe, shutting down workplaces and institutions, pausing most travel, etc. News reports frame the virus’ effects chiefly in terms of either epidemiological rates (of morbidity and mortality) or lost capital: store closures and profits lost, jobs lost. Simultaneously, especially outside of COVID-19 “hot spots” like New York City in April (when ambulance sirens blared every few minutes, neighbors left and did not come back, and trailer trucks were filled with corpses on hospital parking lots), the virus has somehow remained abstract, invisible, and intangible to so many-- so that large swaths of Americans, following our current President, claim that it is nothing more than a “typical flu,” a conspiracy, and/ or alien and “Chinese.” | ||
|
||
National figures for COVID-19 infections and deaths are so large that they strike many of us as simultaneously overwhelming and meaningless or incomprehensible. Meanwhile, lockdowns have made our everyday lives devoid of in-person interactions (handshakes, hugs, physical touch), and have instead rendered our computers and phones as the primary or even sole means through which we experience, understand, or engage with the larger, “outside” world during this global pandemic. | ||
|
||
## Usage | ||
|
||
Installation and development requires: | ||
- [electron](https://www.electronjs.org/) | ||
- [electron-packager](https://github.com/electron/electron-packager) | ||
|
||
To run locally: | ||
|
||
```sh | ||
$ npm run start | ||
``` | ||
|
||
To build binaries: | ||
|
||
```sh | ||
# macOS | ||
$ npm run build-mac | ||
# Windows | ||
$ npm run build-win | ||
# Linux | ||
$ npm run build-linux | ||
``` | ||
|
||
## Acknowledgments | ||
|
||
The project makes use of the following tools for CPU stressing: | ||
- [stress-ng](https://manpages.ubuntu.com/manpages/artful/man1/stress-ng.1.html) (macOS, Linux) | ||
- [WindowsStress.exe](https://github.com/RichardKav/Stress-for-Windows) (Windows) | ||
|
||
The COVID-19 data is being accessed from: | ||
- [https://covidtracking.com/](https://covidtracking.com/) | ||
|
||
## Disclaimer | ||
|
||
Pandemic Pulse does not alter any persistant data on your hard drive. However, as with any software, use at your own risk. |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
COVID-19 Datasource | ||
*/ | ||
const fetch = require("node-fetch"); | ||
const population = require('./population'); | ||
const SCALER_DEATH = 50 | ||
const SCALER_INFECTIONS = 100 | ||
|
||
const getAll = (location) => { | ||
return new Promise(function (resolve, reject) { | ||
get(location).then(data => { | ||
const today = data[0].deathIncrease | ||
const last = data[14].deathIncrease | ||
const daily = data.map(d => d.deathIncrease) | ||
const change = Math.round((today - last) / today * 100.0); | ||
resolve(Math.round(Math.max(0, change))) | ||
}) | ||
.catch(err => { | ||
reject(err) | ||
}) | ||
}) | ||
} | ||
|
||
const getRate = (location) => { | ||
return new Promise(function (resolve, reject) { | ||
get(location).then(data => { | ||
if (!data) | ||
reject(location, data) | ||
const deaths = calculateDeaths(location, data) | ||
const infections = calculateInfections(location, data) | ||
const covid = Object.assign({}, deaths, infections); | ||
resolve(covid) | ||
}) | ||
.catch(err => { | ||
reject(err) | ||
}) | ||
}) | ||
} | ||
|
||
const calculateDeaths = (location, data) => { | ||
const deathsTwoWeeks = data.slice(0, 13) | ||
.map(d => d.deathIncrease) | ||
.reduce((sum, deaths) => sum + deaths) | ||
const positiveTwoWeeks = data.slice(0, 13) | ||
.map(d => d.positiveIncrease) | ||
.reduce((sum, deaths) => sum + deaths) | ||
const deathRate = ((deathsTwoWeeks / positiveTwoWeeks) * 100).toFixed(2) | ||
const deathRateScaled = (deathRate * SCALER_DEATH).toFixed(2) | ||
const all = data[0].death | ||
const today = data[0].deathIncrease | ||
const deathsFortnightly = data.slice(0, 13).map(d => d.deathIncrease) | ||
console.log(`death rate ${deathRate}`) | ||
console.log(`deaths fortnightly ${data.slice(0, 13).map(d => d.deathIncrease)}`) | ||
return { | ||
"deaths": deathRate, | ||
"deathsToday": today, | ||
"deathsScaled": deathRateScaled, | ||
"deathsFortnightly": deathsFortnightly, | ||
"deathsAll": all | ||
} | ||
} | ||
|
||
const calculateInfections = (location, data) => { | ||
const infectionTwoWeeks = data.slice(0, 13) | ||
.map(d => d.positiveIncrease) | ||
.reduce((sum, deaths) => sum + deaths) | ||
const infectionRate = ((infectionTwoWeeks / population.state(location)) * 100).toFixed(2) | ||
const infectionRateScaled = (infectionRate * SCALER_INFECTIONS).toFixed(2) | ||
const all = data[0].positive | ||
const today = data[0].positiveIncrease | ||
const infectionsFortnightly = data.slice(0, 13).map(d => d.positiveIncrease) | ||
const infectionsAllDaily = data.map(d => d.positiveIncrease) | ||
console.log(`infection rate ${infectionRate}`) | ||
console.log(`infections fortnightly ${data.slice(0, 13).map(d => d.positiveIncrease)}`) | ||
return { | ||
"infections": infectionRate, | ||
"infectionsToday": today, | ||
"infectionsScaled": infectionRateScaled, | ||
"infectionsFortnightly": infectionsFortnightly, | ||
"infectionsAll": all, | ||
"infectionsAllDaily": infectionsAllDaily, | ||
} | ||
} | ||
|
||
|
||
const get = (location) => { | ||
return new Promise(function (resolve, reject) { | ||
let url; | ||
if (location == 'us' || !location) | ||
url = `https://covidtracking.com/api/v1/us/daily.json` | ||
else | ||
url = `https://covidtracking.com/api/v1/states/${location}/daily.json` | ||
fetch(url) | ||
.then(response => response.json()) | ||
.then(data => { | ||
resolve(data) | ||
}) | ||
.catch(err => { | ||
reject(err) | ||
}) | ||
}); | ||
} | ||
|
||
exports.get = get | ||
exports.getRate = getRate |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const appRoot = require('app-root-path') | ||
const spawn = require('child_process').spawn | ||
const platform = require('./platform') | ||
const path = require('path') | ||
const osu = require('node-os-utils') | ||
const os = require('os') | ||
|
||
|
||
const rootPath = path.resolve(__dirname) | ||
const RESOURCE_DIR = 'resources' | ||
const PLATFORM = platform.get() | ||
const STRESS = platform.stress() | ||
const STRESS_EXEC_PATH = path.join(rootPath, RESOURCE_DIR, PLATFORM, STRESS) | ||
// const STRESS_SCALER = 6 | ||
|
||
// Run cpu stress executable | ||
const stress = (covid) => { | ||
return new Promise(function (resolve, reject) { | ||
let cpuExecutable; | ||
const infectionPercent = `${Math.min(Math.round(Math.max(covid.infectionsScaled, 0)), 100)}` | ||
if (PLATFORM == 'win') | ||
cpuExecutable = spawn('powershell.exe', ['WindowsStress.exe', infectionPercent, 'all']); | ||
else | ||
cpuExecutable = spawn(STRESS_EXEC_PATH, ['-c', '0', '-l', infectionPercent]); | ||
console.log(`[CPU STRESS]: ${Math.max(covid.infectionsScaled)}%`) | ||
cpuExecutable.stdout.on('data', data => { | ||
console.log(`stdout: ${data}`); | ||
resolve(data) | ||
}); | ||
cpuExecutable.stderr.on('data', data => { | ||
console.log(`stderr: ${data}`); | ||
resolve(reject) | ||
}); | ||
}); | ||
} | ||
|
||
// Kill all stress executable instances | ||
const kill = () => { | ||
return new Promise(function (resolve, reject) { | ||
let child; | ||
if (PLATFORM == 'win') | ||
child = spawn('powershell.exe', ['Taskkill', '/IM', 'WindowsStress.exe', '/F']) | ||
else | ||
child = spawn('killall', [`${platform.stress()}`]) | ||
child.stdout.on('data', data => { | ||
console.log(`stdout: ${data}`) | ||
resolve(data) | ||
}); | ||
child.stderr.on('data', data => { | ||
console.log(`stderr: ${data}`) | ||
resolve(reject) | ||
}); | ||
}); | ||
} | ||
|
||
const usage = () => { | ||
return new Promise(function (resolve, reject) { | ||
const cpu = osu.cpu | ||
// const count = cpu.count() | ||
const mem = osu.mem | ||
|
||
const memUsage = mem.info() | ||
.then(memInfo => { | ||
return { "memory": memInfo.freeMemPercentage } | ||
}) | ||
const cpuUsage = cpu.usage() | ||
.then(cpuPercentage => { | ||
return { "cpu": cpuPercentage } | ||
}) | ||
Promise.all([cpuUsage, memUsage]).then(stats => { | ||
resolve(Object.assign({}, ...stats)) | ||
}) | ||
}) | ||
} | ||
|
||
exports.stress = stress | ||
exports.kill = kill | ||
exports.usage = usage | ||
|
Oops, something went wrong.