Skip to content

Instantly share code, notes, and snippets.

View bnb's full-sized avatar

Tierney Cyren bnb

View GitHub Profile

Go to:

https://webrtc.github.io/samples/src/content/peerconnection/pc1/

Start the video and the call.

The RTCPeerConnections are under the variables pc1 and pc2. In the console, run:

const stats1 = await pc1.getStats()
https://www.w3.org/TR/webrtc/#getstats-example
async function parseOptions (options) {
const parsedOptions = {
urls: {
index: 'https://nodejs.org/dist/index.json',
schedule: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'
}
}
if(options?.urls?.index) {
parsedOptions.urls.index = options.urls.index
const { DateTime } = require('luxon')
const now = DateTime.now()
const currentYear = now.year
const lastMonth = now.minus({ months: 1 })
const lastDayOfPreviousMonth = lastMonth.set({ day: lastMonth.daysInMonth })
const dates = {
now: now.toISODate(), // make `now` usable with ISO date format
lastDayOfPreviousMonth: lastDayOfPreviousMonth.toISODate(), // gets the last day of the previous month
@bnb
bnb / delete-node-modules.yml
Last active November 19, 2020 21:59
Delete `node_modules` on push to the default branch
name: Delete node_modules on merge
on:
push:
branches:
- [ $default-branch ]
jobs:
delete-modules:
runs-on: ubuntu-latest
steps:

List of Issues:

  • nodejs/node
    • review all contributing documentation (there's a lot!)
    • evaluate contributing documentation length
      • there's currently a lot to read. Is it reasonable to expect folks to read every word? Are there parts we can automate and yeet manual documentation?
  • nodejs/tsc
    • validating that charters are actually up to date with current practices
    • updating working group document
  • worth consolidating wg/team/other group information so it's all easily accessible?

Hacky Way to Get Among Us Running with "Local" Rather than the Central Servers

You will need one user who is the Admin and will run the Local game, and all Users will connect to the Admin's network. Instructions for each user - Admin and User - are below.

Admin:

  • Download and run ZeroTier on your machine
  • Sign in to the web client (my.zerotier.com/network)
    • Ensure it's set to private so rando's don't join
  • Share the Network ID with all your users, and when they join click the checkbox in the in the "Auth?" Column
async function replaceVariables (stringifiedTemplate, templateVariables, templateValues) {
// replace each template variable with the relevant variable
try {
// - replace name
if (stringifiedTemplate.includes(templateVariables.name)) {
const RegExNameBecauseReplaceAllDidntExistInJavaScriptUntilRecently = new RegExp(templateVariables.name, 'g')
stringifiedTemplate = stringifiedTemplate.replace(RegExNameBecauseReplaceAllDidntExistInJavaScriptUntilRecently, templateValues.name)
}
@bnb
bnb / rip.js
Last active July 30, 2020 14:29
rip
const ghUserEvents = require('gh-user-events');
var watches = 0;
var comments = 0;
var pushes = 0;
var prs = 0;
var createRepos = 0;
var deleteRepos = 0;
var reviews = 0;
var issues = 0;

npm ls commands

  • npm ls # list all modules in node_modules
    • lists all modules
  • npm ls --depth=0 # list all direct deps and devDeps
    • lists all modules that are direct dependencies (0 levels deep in the dependency tree)
  • npm ls <module> # list all trees that include <module>
    • lets you filter for a specific module
  • npm ls --prod # only show production modules + their deps
    • lets you filter for only production dependencies (dependencies in the dependencies property of package.json)
  • npm ls --prod --depth=0 # only show direct prod deps